Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jan 2009 19:48:42 -0800
From:      Tim Kientzle <kientzle@freebsd.org>
To:        Tim Kientzle <kientzle@freebsd.org>
Cc:        freebsd-hackers@freebsd.org, pluknet <pluknet@gmail.com>
Subject:   Re: extattr problems?
Message-ID:  <496ABD9A.8080006@freebsd.org>
In-Reply-To: <496AA714.1090904@freebsd.org>
References:  <49692659.2030306@freebsd.org>		<a31046fc0901101836q1f43028awe4f7b0ba746248ac@mail.gmail.com>		<49696C24.8010601@freebsd.org>	<a31046fc0901110004m629f9aeegc4ac1cdfd1591c69@mail.gmail.com> <496AA714.1090904@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I think this one is a bug.  It appears that extattr_set_fd()
obeys the permissions on the file, not the permissions
of the descriptor.  In particular, I see this on
FreeBSD 6.3:

[tim@dark /tmp]$ ./extattr_test
fd=3
extattr_set_fd() = -1
    errno = 13 (Permission denied)
[tim@dark /tmp]$ cat extattr_test.c
#include <sys/types.h>
#include <sys/extattr.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>

int
main(int argc, char **argv)
{
         int n, fd;

         fd = open("/tmp/test12345", O_RDWR | O_CREAT | O_EXCL, 0000);
         printf("fd=%d\n", fd);
         n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER,
		"testattr", "1234", 4);
         printf("extattr_set_fd() = %d\n", n);
         if (n != 0)
                 printf("errno = %d (%s)\n",
			errno, strerror(errno));
         exit(0);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?496ABD9A.8080006>