fsetxattr() fails on a writable descriptor?
Pádraig Brady
P at draigBrady.com
Tue Sep 8 06:29:49 CDT 2009
fsetxattr() is failing for me when the permissions are readonly
but the descriptor is writable as demonstrated by the program below.
I've tried this on ext3 and ext4 with libattr-2.4.43-3.fc11.i586
and linux-2.6.30.5-43.fc11.i586
Is this expected?
cheers,
Pádraig.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <attr/libattr.h>
#include <stdio.h>
#include <unistd.h>
int main(void)
{
int wfd;
if ((wfd=open("writable", O_CREAT|O_WRONLY|O_EXCL, S_IRUSR)) == -1)
fprintf(stderr, "open('writable') error [%m]\n");
if (write(wfd, "data", 1) == -1)
fprintf(stderr, "write() error [%m]\n");
if (fsetxattr(wfd, "user.test", "test", 4, 0) == -1)
fprintf(stderr, "fsetxattr() error [%m]\n");
}
More information about the xfs
mailing list