2009/1/11 Tim Kientzle <kient...@freebsd.org>:
> FreeBSD 6.3:
>
> fd = open("test", O_WRONLY | O_CREAT | O_EXCL, 0777);
> n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, "testattr", "1234", 4);
>
> After this, fd=3, n is non-zero, errno = 9 (EBADF)
>
> Huh?  I would have expected EOPNOTSUPP if
> extended attributes weren't supported on this
> filesystem.  The file descriptor is clearly
> valid.

Simple guess.
Don't hit me if I'm wrong. :)

You call open() with (O_CREAT | O_EXCL) on an already existing file.
If such then open() returns -1 with EEXIST and subsequent extattr_set_fd() call
with fd (-1) returns EBADF from getvnode() on failed
(td->td_proc->p_fd == NULL)
or
(fp = fdp->fd_ofiles[fd]) == NULL)
checks.

>
> Tim

-- 
wbr,
pluknet
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to