diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 23:27:12 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 23:27:12 +0200 |
commit | 26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch) | |
tree | c4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/error.c | |
parent | 5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff) | |
download | monitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz |
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/error.c')
-rw-r--r-- | gl/error.c | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* Error handler for noninteractive utilities | 1 | /* Error handler for noninteractive utilities |
2 | Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. | 2 | Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
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 |
@@ -54,7 +54,7 @@ | |||
54 | function without parameters instead. */ | 54 | function without parameters instead. */ |
55 | void (*error_print_progname) (void); | 55 | void (*error_print_progname) (void); |
56 | 56 | ||
57 | /* This variable is incremented each time `error' is called. */ | 57 | /* This variable is incremented each time 'error' is called. */ |
58 | unsigned int error_message_count; | 58 | unsigned int error_message_count; |
59 | 59 | ||
60 | #ifdef _LIBC | 60 | #ifdef _LIBC |
@@ -65,7 +65,7 @@ unsigned int error_message_count; | |||
65 | # include <limits.h> | 65 | # include <limits.h> |
66 | # include <libio/libioP.h> | 66 | # include <libio/libioP.h> |
67 | 67 | ||
68 | /* In GNU libc we want do not want to use the common name `error' directly. | 68 | /* In GNU libc we want do not want to use the common name 'error' directly. |
69 | Instead make it a weak alias. */ | 69 | Instead make it a weak alias. */ |
70 | extern void __error (int status, int errnum, const char *message, ...) | 70 | extern void __error (int status, int errnum, const char *message, ...) |
71 | __attribute__ ((__format__ (__printf__, 3, 4))); | 71 | __attribute__ ((__format__ (__printf__, 3, 4))); |
@@ -89,19 +89,25 @@ extern void __error_at_line (int status, int errnum, const char *file_name, | |||
89 | # include <unistd.h> | 89 | # include <unistd.h> |
90 | 90 | ||
91 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 91 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
92 | /* Get declarations of the Win32 API functions. */ | 92 | /* Get declarations of the native Windows API functions. */ |
93 | # define WIN32_LEAN_AND_MEAN | 93 | # define WIN32_LEAN_AND_MEAN |
94 | # include <windows.h> | 94 | # include <windows.h> |
95 | /* Get _get_osfhandle. */ | ||
96 | # include "msvc-nothrow.h" | ||
95 | # endif | 97 | # endif |
96 | 98 | ||
97 | /* The gnulib override of fcntl is not needed in this file. */ | 99 | /* The gnulib override of fcntl is not needed in this file. */ |
98 | # undef fcntl | 100 | # undef fcntl |
99 | 101 | ||
100 | # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P | 102 | # if !HAVE_DECL_STRERROR_R |
101 | # ifndef HAVE_DECL_STRERROR_R | 103 | # ifndef HAVE_DECL_STRERROR_R |
102 | "this configure-time declaration test was not run" | 104 | "this configure-time declaration test was not run" |
103 | # endif | 105 | # endif |
106 | # if STRERROR_R_CHAR_P | ||
104 | char *strerror_r (); | 107 | char *strerror_r (); |
108 | # else | ||
109 | int strerror_r (); | ||
110 | # endif | ||
105 | # endif | 111 | # endif |
106 | 112 | ||
107 | /* The calling program should define program_name and set it to the | 113 | /* The calling program should define program_name and set it to the |
@@ -115,13 +121,14 @@ extern char *program_name; | |||
115 | 121 | ||
116 | #if !_LIBC | 122 | #if !_LIBC |
117 | /* Return non-zero if FD is open. */ | 123 | /* Return non-zero if FD is open. */ |
118 | static inline int | 124 | static int |
119 | is_open (int fd) | 125 | is_open (int fd) |
120 | { | 126 | { |
121 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 127 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
122 | /* On Win32: The initial state of unassigned standard file descriptors is | 128 | /* On native Windows: The initial state of unassigned standard file |
123 | that they are open but point to an INVALID_HANDLE_VALUE. There is no | 129 | descriptors is that they are open but point to an INVALID_HANDLE_VALUE. |
124 | fcntl, and the gnulib replacement fcntl does not support F_GETFL. */ | 130 | There is no fcntl, and the gnulib replacement fcntl does not support |
131 | F_GETFL. */ | ||
125 | return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; | 132 | return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; |
126 | # else | 133 | # else |
127 | # ifndef F_GETFL | 134 | # ifndef F_GETFL |
@@ -132,7 +139,7 @@ is_open (int fd) | |||
132 | } | 139 | } |
133 | #endif | 140 | #endif |
134 | 141 | ||
135 | static inline void | 142 | static void |
136 | flush_stdout (void) | 143 | flush_stdout (void) |
137 | { | 144 | { |
138 | #if !_LIBC | 145 | #if !_LIBC |