open-safer.c: avoid 'signed and unsigned in conditional...' warning
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Oct 2008 19:48:54 +0000 (21:48 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 16 Oct 2008 19:48:54 +0000 (21:48 +0200)
* lib/open-safer.c (open_safer): Use an "if/else" statement in place
of the ternary operator.  Reported by Reuben Thomas <rrt@sc3d.org>.

ChangeLog
lib/open-safer.c

index 0394202..5bd8819 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       open-safer.c: avoid 'signed and unsigned in conditional...' warning
+       * lib/open-safer.c (open_safer): Use an "if/else" statement in place
+       of the ternary operator.  Reported by Reuben Thomas <rrt@sc3d.org>.
+
 2008-10-16  Jim Meyering  <meyering@redhat.com>
 
        openat-die.c: avoid 'no previous prototype' warning
index ce493d5..15bf6a6 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke open, but avoid some glitches.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -38,9 +38,10 @@ open_safer (char const *file, int flags, ...)
       /* Assume mode_t promotes to int if and only if it is smaller.
         This assumption isn't guaranteed by the C standard, but we
         don't know of any real-world counterexamples.  */
-      mode = (sizeof (mode_t) < sizeof (int)
-             ? va_arg (ap, int)
-             : va_arg (ap, mode_t));
+      if (sizeof (mode_t) < sizeof (int))
+       mode = va_arg (ap, int);
+      else
+       mode = va_arg (ap, mode_t);
 
       va_end (ap);
     }