[Gluster-devel] NULL loc in posix_acl_truncate

Emmanuel Dreyfus manu at netbsd.org
Sat May 26 14:20:10 UTC 2012

Vijay Bellur <vbellur at redhat.com> wrote:

> I don't think it is a f-style problem. I do not get a EPERM with the 
> testcase that you posted for qa39. Can you please provide a bigger bt?

Here is a minimal test case that reproduces the problem at mine. Run it
as un unprivilegied user in a directory you on which you have write

$ pwd
$ ls -ld .
drwxr-xr-x  4 manu  manu  512 May 26 16:17 .
$ id
uid=500(manu) gid=500(manu) groups=500(manu),0(wheel)
$ ./test
test: fchmod failed: Permission denied

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <err.h>
#include <errno.h>
#include <sysexits.h>
#include <sys/stat.h>

#define TESTFILE "testfile"

        int fd;
        char buf[16384];

        if ((unlink(TESTFILE) == -1) && (errno != ENOENT))
                err(EX_OSERR, "unlink failed");

        if ((fd = open(TESTFILE, O_CREAT|O_EXCL|O_RDWR, 0600)) == -1)
                err(EX_OSERR, "open failed");

        if (write(fd, buf, sizeof(buf)) != sizeof(buf))
                err(EX_OSERR, "write failed");

        if (fchmod(fd, 0555) == -1)
                err(EX_OSERR, "fchmod failed");

        if (close(fd) == -1)
                err(EX_OSERR, "close failed");

        return EX_OK;

Emmanuel Dreyfus
manu at netbsd.org

More information about the Gluster-devel mailing list