bug-fileutils
[Top][All Lists]
Advanced

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

Re: chmod g=o


From: Jim Meyering
Subject: Re: chmod g=o
Date: Mon, 19 Nov 2001 21:45:03 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1.50 (i686-pc-linux-gnu)

"Juan F.Codagnone" <address@hidden> wrote:
> On Saturday 17 November 2001 11:07, Juan F. Codagnone wrote:
>> The fix is easy. a copy/paste bug.
>>
>> in lib/modechange.c line 427 says
>>             value |=   (value & S_IWOTH ? S_IWUSR | S_IRGRP : 0);
>> it should be
>>      value |=   (value & S_IWOTH ? S_IWUSR | S_IWGRP : 0);
>> the same bugs are at line 422 and 417. Am i right?

Thanks a lot for the report and fix.
I've applied the following patch and added a test case.

Index: modechange.c
===================================================================
RCS file: /fetish/fileutils/lib/modechange.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -p -u -r1.21 -r1.22
--- modechange.c        2001/01/07 09:20:47     1.21
+++ modechange.c        2001/11/19 13:32:23     1.22
@@ -413,18 +413,18 @@ mode_adjust (mode_t oldmode, const struc
 
          if (changes->value & S_IRWXU)
            /* Copy `u' permissions onto `g' and `o'. */
-           value |= ((value & S_IRUSR ? S_IRGRP | S_IROTH : 0)
-                     | (value & S_IWUSR ? S_IWGRP | S_IROTH : 0)
+           value |= (  (value & S_IRUSR ? S_IRGRP | S_IROTH : 0)
+                     | (value & S_IWUSR ? S_IWGRP | S_IWOTH : 0)
                      | (value & S_IXUSR ? S_IXGRP | S_IXOTH : 0));
          else if (changes->value & S_IRWXG)
            /* Copy `g' permissions onto `u' and `o'. */
-           value |= ((value & S_IRGRP ? S_IRUSR | S_IROTH : 0)
-                     | (value & S_IWGRP ? S_IWUSR | S_IROTH : 0)
+           value |= (  (value & S_IRGRP ? S_IRUSR | S_IROTH : 0)
+                     | (value & S_IWGRP ? S_IWUSR | S_IWOTH : 0)
                      | (value & S_IXGRP ? S_IXUSR | S_IXOTH : 0));
          else
            /* Copy `o' permissions onto `u' and `g'. */
-           value |= ((value & S_IROTH ? S_IRUSR | S_IRGRP : 0)
-                     | (value & S_IWOTH ? S_IWUSR | S_IRGRP : 0)
+           value |= (  (value & S_IROTH ? S_IRUSR | S_IRGRP : 0)
+                     | (value & S_IWOTH ? S_IWUSR | S_IWGRP : 0)
                      | (value & S_IXOTH ? S_IXUSR | S_IXGRP : 0));
 
          /* In order to change only `u', `g', or `o' permissions,



reply via email to

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