[PATCH v4] allow disabling ACL

Peter Wu lekensteyn at gmail.com
Fri Apr 4 08:10:31 PDT 2014


On Friday 04 April 2014 17:24:04 David Heidelberger wrote:
> >>             /* Finally, add the read+execute ACL for $USER */
> >> +#ifdef HAVE_ACL
> >>             if (!add_acl (mount_dir, uid, error))
> >> +#else
> >> +          if (chown (mount_dir, -1, gid) == -1)
> > 
> > add_acl seems to report an error if something fails, wouldn't that also
> > be useful here?
> 
> chown also report error 

Actually, it doesn't. If chown fails, then it branches immediately to
mkdir() so the errno is lost. Oh, and I just noticed that "error" is not
set either, so the caller has no idea that this function failed.
"%m" seems to be a glib-specific modifier that gets expanded to the error
message. What about (typing from my hand, please excuse any errors):

#ifdef HAVE_ACL
    if (!add_acl (mount_dir, uid, error))
      {
#else
    if (chown (mount_dir, -1, gid) == -1)
      {
        g_set_error (error, G_IO_ERROR,
                            g_io_error_from_errno (errno),
                            "Failed to change gid to %d for %s: %m",
                            (gint) gid, path);
#endif

Kind regards,
Peter


More information about the devkit-devel mailing list