X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fopen-safer.c;h=badeffade4660a9c001adf0a31ed401d8b1cc6db;hb=bbfcd2f1a92c9bdbb8d7d7d0a8a8c6665c316747;hp=15bf6a65d01dda9e563ffc7aed925b54ac7ce0ef;hpb=1b71c50d5a227649f1bcc11cf79e2be7ef68fff8;p=gnulib.git diff --git a/lib/open-safer.c b/lib/open-safer.c index 15bf6a65d..badeffade 100644 --- a/lib/open-safer.c +++ b/lib/open-safer.c @@ -1,6 +1,6 @@ /* Invoke open, but avoid some glitches. - Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2013 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 @@ -35,13 +35,9 @@ open_safer (char const *file, int flags, ...) va_list ap; va_start (ap, 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. */ - if (sizeof (mode_t) < sizeof (int)) - mode = va_arg (ap, int); - else - mode = va_arg (ap, mode_t); + /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 + creates crashing code when 'mode_t' is smaller than 'int'. */ + mode = va_arg (ap, PROMOTED_MODE_T); va_end (ap); }