[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fsetxattr() fails on a writable descriptor?

From: Pádraig Brady
Subject: fsetxattr() fails on a writable descriptor?
Date: Tue, 8 Sep 2009 12:29:49 +0100
User-agent: Thunderbird (X11/20071008)

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-

Is this expected?


#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");

reply via email to

[Prev in Thread] Current Thread [Next in Thread]