bug-gnulib
[Top][All Lists]
Advanced

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

[bug-gnulib] Bugs in chown module


From: Eric Blake
Subject: [bug-gnulib] Bugs in chown module
Date: Tue, 17 May 2005 20:36:45 +0000

Looking at m4/chown.m4, the test for defining 
CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE uses the wrong sense, since 
ac_cv_func_chown_works is yes iff not cross-compiling and chown(f,-1,-1) didn't 
change the struct stat owners.  Furthermore, in lib/chown.c, when this C macro 
is defined, the code violates POSIX by not returning -1 on failure.

One potential issue not solved by this patch is whether rpl_chown should use 
getuid/getgid rather than stat.  Another potential issue is that when 
cross-compiling, AC_FUNC_CHOWN defaults to no, but 
gl_FUNC_CHOWN_FOLLOWS_SYMLINK defaults to yes, meaning that rpl_chown will be 
active, and will try to call chown.  Are there any systems targetted by gnulib 
that don't even have a chown(2)?  (This is not an issue on native compiles, 
since if chown doesn't exist, gl_FUNC_CHOWN_FOLLOWS_SYMLINK will be no, and 
rpl_chown then falls back on fchown which is properly stubbed).

lib/ChangeLog:
2005-05-17  Eric Blake  <address@hidden>  (tiny change)

        * chown.c (rpl_chown): Return -1 on failure.

m4/ChangeLog:
2005-05-17  Eric Blake  <address@hidden>  (tiny change)

        * chown.m4 (gl_FUNC_CHOWN): Correct sense of test for honoring IDs
        of -1.


--
Eric Blake

Attachment: gnulib.patch
Description: Binary data


reply via email to

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