install: avoid warning with Solaris 10 cc
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 14 Oct 2010 03:44:12 +0000 (20:44 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 14 Oct 2010 05:41:21 +0000 (22:41 -0700)
* src/install.c (extra_mode): Don't assign ~S_IRWXUGO & ~S_IFMT
to a mode_t variable, as the number might be too big to fit.
Solaris 10 cc warns about this, and the C standard says it
has undefined behavior.

src/install.c

index 9702914..467e500 100644 (file)
@@ -186,8 +186,8 @@ have_same_content (int a_fd, int b_fd)
 static bool
 extra_mode (mode_t input)
 {
-  const mode_t mask = ~S_IRWXUGO & ~S_IFMT;
-  return !! (input & mask);
+  mode_t mask = S_IRWXUGO | S_IFMT;
+  return !! (input & mask);
 }
 
 /* Return true if copy of file SRC_NAME to file DEST_NAME is necessary. */