linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jvrao <jvrao@linux.vnet.ibm.com>
To: linux-ext4@vger.kernel.org
Subject: lsetxattr/lgetxattr on ext4.
Date: Wed, 31 Mar 2010 17:06:13 -0700	[thread overview]
Message-ID: <4BB3E375.5010604@linux.vnet.ibm.com> (raw)

lsetxattr()/lgetxsttr() functions are not working on a ext4 symlink. 
But works fine on a regular file.

I tried the following program.. Not sure if I am missing something.
Any help will be appreciated.


--------- simple program -------------
[jvrao]# cat sxl.c
#include <stdio.h>
#include <sys/types.h>
#include <attr/xattr.h>

main()
{
	int ha=5;
	int ha_out=-1;
	int err;
	err = lsetxattr("./foo", "user.junk", &ha, sizeof(int),0);
	if (err == -1)
		perror("lsetxattr failed");
	lgetxattr("./foo", "user.junk", &ha_out, sizeof(int));
	if (err == -1)
		perror("lsetxattr failed");
	printf("file:./foo ha:%d  ha_out:%d\n", ha, ha_out);

	ha_out = -1;
	err = lsetxattr("./foo.sl", "user.junk", &ha, sizeof(int),0);
	if (err == -1)
		perror("lsetxattr failed");
	lgetxattr("./foo.sl", "user.junk", &ha_out, sizeof(int));
	if (err == -1)
		perror("lsetxattr failed");
	printf("file:./foo.sl  ha:%d  ha_out:%d\n", ha, ha_out);
}
------------------------

[jvrao]# ls -l foo*
-rw-r--r--. 1 root root 0 2010-03-31 16:49 foo
lrwxrwxrwx. 1 root root 3 2010-03-31 16:49 foo.sl -> foo

[jvrao]# ./sxl
file:./foo ha:5  ha_out:5
lsetxattr failed: Operation not permitted
lsetxattr failed: Operation not permitted
file:./foo.sl  ha:5  ha_out:-1




             reply	other threads:[~2010-04-01  0:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-01  0:06 jvrao [this message]
2010-04-01 21:54 ` lsetxattr/lgetxattr on ext4 Mingming Cao
2010-04-01 22:01   ` Eric Sandeen
2010-04-01 22:34     ` jvrao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BB3E375.5010604@linux.vnet.ibm.com \
    --to=jvrao@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).