summaryrefslogtreecommitdiffstats
path: root/gl/open-safer.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/open-safer.c')
-rw-r--r--gl/open-safer.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gl/open-safer.c b/gl/open-safer.c
index 15bf6a6..3b36471 100644
--- a/gl/open-safer.c
+++ b/gl/open-safer.c
@@ -1,6 +1,6 @@
1/* Invoke open, but avoid some glitches. 1/* Invoke open, but avoid some glitches.
2 2
3 Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -35,13 +35,9 @@ open_safer (char const *file, int flags, ...)
35 va_list ap; 35 va_list ap;
36 va_start (ap, flags); 36 va_start (ap, flags);
37 37
38 /* Assume mode_t promotes to int if and only if it is smaller. 38 /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
39 This assumption isn't guaranteed by the C standard, but we 39 creates crashing code when 'mode_t' is smaller than 'int'. */
40 don't know of any real-world counterexamples. */ 40 mode = va_arg (ap, PROMOTED_MODE_T);
41 if (sizeof (mode_t) < sizeof (int))
42 mode = va_arg (ap, int);
43 else
44 mode = va_arg (ap, mode_t);
45 41
46 va_end (ap); 42 va_end (ap);
47 } 43 }