summaryrefslogtreecommitdiffstats
path: root/gl/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/strerror.c')
-rw-r--r--gl/strerror.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gl/strerror.c b/gl/strerror.c
index 6b760ff4..c451f055 100644
--- a/gl/strerror.c
+++ b/gl/strerror.c
@@ -1,6 +1,6 @@
1/* strerror.c --- POSIX compatible system error routine 1/* strerror.c --- POSIX compatible system error routine
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file 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 Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -31,12 +31,17 @@
31/* Use the system functions, not the gnulib overrides in this file. */ 31/* Use the system functions, not the gnulib overrides in this file. */
32#undef sprintf 32#undef sprintf
33 33
34/* macOS 12's "warning: 'sprintf' is deprecated" is pointless,
35 as sprintf is used safely here. */
36#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2)
37# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
38#endif
39
34char * 40char *
35strerror (int n) 41strerror (int n)
36#undef strerror 42#undef strerror
37{ 43{
38 static char buf[STACKBUF_LEN]; 44 static char buf[STACKBUF_LEN];
39 size_t len;
40 45
41 /* Cast away const, due to the historical signature of strerror; 46 /* Cast away const, due to the historical signature of strerror;
42 callers should not be modifying the string. */ 47 callers should not be modifying the string. */
@@ -61,7 +66,7 @@ strerror (int n)
61 } 66 }
62 67
63 /* Fix STACKBUF_LEN if this ever aborts. */ 68 /* Fix STACKBUF_LEN if this ever aborts. */
64 len = strlen (msg); 69 size_t len = strlen (msg);
65 if (sizeof buf <= len) 70 if (sizeof buf <= len)
66 abort (); 71 abort ();
67 72