diff options
Diffstat (limited to 'gl/strerror-override.c')
-rw-r--r-- | gl/strerror-override.c | 104 |
1 files changed, 54 insertions, 50 deletions
diff --git a/gl/strerror-override.c b/gl/strerror-override.c index d0ed2fb8..6be1afdc 100644 --- a/gl/strerror-override.c +++ b/gl/strerror-override.c | |||
@@ -1,19 +1,19 @@ | |||
1 | /* strerror-override.c --- POSIX compatible system error routine | 1 | /* strerror-override.c --- POSIX compatible system error routine |
2 | 2 | ||
3 | Copyright (C) 2010-2013 Free Software Foundation, Inc. | 3 | Copyright (C) 2010-2022 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This file 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 Lesser General Public License as |
7 | the Free Software Foundation; either version 3 of the License, or | 7 | published by the Free Software Foundation; either version 2.1 of the |
8 | (at your option) any later version. | 8 | License, or (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ | 18 | /* Written by Bruno Haible <bruno@clisp.org>, 2010. */ |
19 | 19 | ||
@@ -29,6 +29,8 @@ | |||
29 | # endif | 29 | # endif |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #if !GNULIB_defined_strerror_override_macro | ||
33 | |||
32 | /* If ERRNUM maps to an errno value defined by gnulib, return a string | 34 | /* If ERRNUM maps to an errno value defined by gnulib, return a string |
33 | describing the error. Otherwise return NULL. */ | 35 | describing the error. Otherwise return NULL. */ |
34 | const char * | 36 | const char * |
@@ -37,12 +39,12 @@ strerror_override (int errnum) | |||
37 | /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ | 39 | /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ |
38 | switch (errnum) | 40 | switch (errnum) |
39 | { | 41 | { |
40 | #if REPLACE_STRERROR_0 | 42 | # if REPLACE_STRERROR_0 |
41 | case 0: | 43 | case 0: |
42 | return "Success"; | 44 | return "Success"; |
43 | #endif | 45 | # endif |
44 | 46 | ||
45 | #if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */ | 47 | # if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */ |
46 | case EINPROGRESS: | 48 | case EINPROGRESS: |
47 | return "Operation now in progress"; | 49 | return "Operation now in progress"; |
48 | case EALREADY: | 50 | case EALREADY: |
@@ -89,8 +91,8 @@ strerror_override (int errnum) | |||
89 | return "No route to host"; | 91 | return "No route to host"; |
90 | case EWOULDBLOCK: | 92 | case EWOULDBLOCK: |
91 | return "Operation would block"; | 93 | return "Operation would block"; |
92 | #endif | 94 | # endif |
93 | #if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */ | 95 | # if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */ |
94 | case ETXTBSY: | 96 | case ETXTBSY: |
95 | return "Text file busy"; | 97 | return "Text file busy"; |
96 | case ENODATA: | 98 | case ENODATA: |
@@ -103,8 +105,8 @@ strerror_override (int errnum) | |||
103 | return "Timer expired"; | 105 | return "Timer expired"; |
104 | case EOTHER: | 106 | case EOTHER: |
105 | return "Other error"; | 107 | return "Other error"; |
106 | #endif | 108 | # endif |
107 | #if GNULIB_defined_EWINSOCK /* native Windows platforms */ | 109 | # if GNULIB_defined_EWINSOCK /* native Windows platforms */ |
108 | case ESOCKTNOSUPPORT: | 110 | case ESOCKTNOSUPPORT: |
109 | return "Socket type not supported"; | 111 | return "Socket type not supported"; |
110 | case EPFNOSUPPORT: | 112 | case EPFNOSUPPORT: |
@@ -125,7 +127,7 @@ strerror_override (int errnum) | |||
125 | return "Stale NFS file handle"; | 127 | return "Stale NFS file handle"; |
126 | case EREMOTE: | 128 | case EREMOTE: |
127 | return "Object is remote"; | 129 | return "Object is remote"; |
128 | # if HAVE_WINSOCK2_H | 130 | # if HAVE_WINSOCK2_H |
129 | /* WSA_INVALID_HANDLE maps to EBADF */ | 131 | /* WSA_INVALID_HANDLE maps to EBADF */ |
130 | /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ | 132 | /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ |
131 | /* WSA_INVALID_PARAMETER maps to EINVAL */ | 133 | /* WSA_INVALID_PARAMETER maps to EINVAL */ |
@@ -213,90 +215,92 @@ strerror_override (int errnum) | |||
213 | case WSANO_DATA: | 215 | case WSANO_DATA: |
214 | return "Valid name, no data record of requested type"; | 216 | return "Valid name, no data record of requested type"; |
215 | /* WSA_QOS_* omitted */ | 217 | /* WSA_QOS_* omitted */ |
218 | # endif | ||
216 | # endif | 219 | # endif |
217 | #endif | ||
218 | 220 | ||
219 | #if GNULIB_defined_ENOMSG | 221 | # if GNULIB_defined_ENOMSG |
220 | case ENOMSG: | 222 | case ENOMSG: |
221 | return "No message of desired type"; | 223 | return "No message of desired type"; |
222 | #endif | 224 | # endif |
223 | 225 | ||
224 | #if GNULIB_defined_EIDRM | 226 | # if GNULIB_defined_EIDRM |
225 | case EIDRM: | 227 | case EIDRM: |
226 | return "Identifier removed"; | 228 | return "Identifier removed"; |
227 | #endif | 229 | # endif |
228 | 230 | ||
229 | #if GNULIB_defined_ENOLINK | 231 | # if GNULIB_defined_ENOLINK |
230 | case ENOLINK: | 232 | case ENOLINK: |
231 | return "Link has been severed"; | 233 | return "Link has been severed"; |
232 | #endif | 234 | # endif |
233 | 235 | ||
234 | #if GNULIB_defined_EPROTO | 236 | # if GNULIB_defined_EPROTO |
235 | case EPROTO: | 237 | case EPROTO: |
236 | return "Protocol error"; | 238 | return "Protocol error"; |
237 | #endif | 239 | # endif |
238 | 240 | ||
239 | #if GNULIB_defined_EMULTIHOP | 241 | # if GNULIB_defined_EMULTIHOP |
240 | case EMULTIHOP: | 242 | case EMULTIHOP: |
241 | return "Multihop attempted"; | 243 | return "Multihop attempted"; |
242 | #endif | 244 | # endif |
243 | 245 | ||
244 | #if GNULIB_defined_EBADMSG | 246 | # if GNULIB_defined_EBADMSG |
245 | case EBADMSG: | 247 | case EBADMSG: |
246 | return "Bad message"; | 248 | return "Bad message"; |
247 | #endif | 249 | # endif |
248 | 250 | ||
249 | #if GNULIB_defined_EOVERFLOW | 251 | # if GNULIB_defined_EOVERFLOW |
250 | case EOVERFLOW: | 252 | case EOVERFLOW: |
251 | return "Value too large for defined data type"; | 253 | return "Value too large for defined data type"; |
252 | #endif | 254 | # endif |
253 | 255 | ||
254 | #if GNULIB_defined_ENOTSUP | 256 | # if GNULIB_defined_ENOTSUP |
255 | case ENOTSUP: | 257 | case ENOTSUP: |
256 | return "Not supported"; | 258 | return "Not supported"; |
257 | #endif | 259 | # endif |
258 | 260 | ||
259 | #if GNULIB_defined_ENETRESET | 261 | # if GNULIB_defined_ENETRESET |
260 | case ENETRESET: | 262 | case ENETRESET: |
261 | return "Network dropped connection on reset"; | 263 | return "Network dropped connection on reset"; |
262 | #endif | 264 | # endif |
263 | 265 | ||
264 | #if GNULIB_defined_ECONNABORTED | 266 | # if GNULIB_defined_ECONNABORTED |
265 | case ECONNABORTED: | 267 | case ECONNABORTED: |
266 | return "Software caused connection abort"; | 268 | return "Software caused connection abort"; |
267 | #endif | 269 | # endif |
268 | 270 | ||
269 | #if GNULIB_defined_ESTALE | 271 | # if GNULIB_defined_ESTALE |
270 | case ESTALE: | 272 | case ESTALE: |
271 | return "Stale NFS file handle"; | 273 | return "Stale NFS file handle"; |
272 | #endif | 274 | # endif |
273 | 275 | ||
274 | #if GNULIB_defined_EDQUOT | 276 | # if GNULIB_defined_EDQUOT |
275 | case EDQUOT: | 277 | case EDQUOT: |
276 | return "Disk quota exceeded"; | 278 | return "Disk quota exceeded"; |
277 | #endif | 279 | # endif |
278 | 280 | ||
279 | #if GNULIB_defined_ECANCELED | 281 | # if GNULIB_defined_ECANCELED |
280 | case ECANCELED: | 282 | case ECANCELED: |
281 | return "Operation canceled"; | 283 | return "Operation canceled"; |
282 | #endif | 284 | # endif |
283 | 285 | ||
284 | #if GNULIB_defined_EOWNERDEAD | 286 | # if GNULIB_defined_EOWNERDEAD |
285 | case EOWNERDEAD: | 287 | case EOWNERDEAD: |
286 | return "Owner died"; | 288 | return "Owner died"; |
287 | #endif | 289 | # endif |
288 | 290 | ||
289 | #if GNULIB_defined_ENOTRECOVERABLE | 291 | # if GNULIB_defined_ENOTRECOVERABLE |
290 | case ENOTRECOVERABLE: | 292 | case ENOTRECOVERABLE: |
291 | return "State not recoverable"; | 293 | return "State not recoverable"; |
292 | #endif | 294 | # endif |
293 | 295 | ||
294 | #if GNULIB_defined_EILSEQ | 296 | # if GNULIB_defined_EILSEQ |
295 | case EILSEQ: | 297 | case EILSEQ: |
296 | return "Invalid or incomplete multibyte or wide character"; | 298 | return "Invalid or incomplete multibyte or wide character"; |
297 | #endif | 299 | # endif |
298 | 300 | ||
299 | default: | 301 | default: |
300 | return NULL; | 302 | return NULL; |
301 | } | 303 | } |
302 | } | 304 | } |
305 | |||
306 | #endif | ||