* openat.c (openat): Use ?:, not if, to work around GCC bug 4210
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Jun 2006 19:15:50 +0000 (19:15 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Jun 2006 19:15:50 +0000 (19:15 +0000)
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210>.
Problem reported by Denis Excoffier in
<http://lists.gnu.org/archive/html/bug-tar/2006-06/msg00023.html>.

lib/ChangeLog
lib/openat.c

index e2ce00d0546b2b70e3a2f8d9229dbbf1b48f73a0..3f5e4daf8fa0538efbd2e5d1b28f00ad4071762b 100644 (file)
@@ -1,3 +1,10 @@
+2006-06-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * openat.c (openat): Use ?:, not if, to work around GCC bug 4210
+       <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210>.
+       Problem reported by Denis Excoffier in
+       <http://lists.gnu.org/archive/html/bug-tar/2006-06/msg00023.html>.
+
 2006-06-19  Simon Josefsson  <jas@extundo.com>
 
        * inet_ntop.c: Always build inet_ntop4, since inet_ntop6 calls it.
index 69d4c23f9add6d9becc19c9fb6535281c833fac2..572e6d55328a3a5e20bcfc4ef050005468f23999 100644 (file)
@@ -54,10 +54,9 @@ openat (int fd, char const *file, int flags, ...)
       /* If mode_t is narrower than int, use the promoted type (int),
          not mode_t.  Use sizeof to guess whether mode_t is nerrower;
          we don't know of any practical counterexamples.  */
-      if (sizeof (mode_t) < sizeof (int))
-       mode = va_arg (arg, int);
-      else
-       mode = va_arg (arg, mode_t);
+      mode = (sizeof (mode_t) < sizeof (int)
+             ? va_arg (arg, int)
+             : va_arg (arg, mode_t));
 
       va_end (arg);
     }