python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / physics / cernlib / 0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch
blobbc8c77f913c623d9b030f1c210510a88bda49e48
1 From a69607c511b6da94cde477283b129cbc9cfdd5a3 Mon Sep 17 00:00:00 2001
2 From: Maximilian Bosch <maximilian@mbosch.me>
3 Date: Tue, 11 Aug 2020 12:32:06 +0200
4 Subject: [PATCH] Use `strerror` rather than `sys_errlist` to fix compilation
5 w/glibc-2.32
7 To quote the release-notes[1]:
9 All programs should use
10 strerror or strerror_r instead.
12 [1] https://sourceware.org/pipermail/libc-announce/2020/000029.html
13 ---
14 2006/src/packlib/cspack/sysreq/serror.c | 10 +---------
15 2006/src/packlib/cspack/sysreq/socket.c | 2 +-
16 2006/src/packlib/kernlib/kernbit/z268/systems.c | 4 ++--
17 2006/src/pawlib/paw/piafs/piafc.c | 5 +----
18 4 files changed, 5 insertions(+), 16 deletions(-)
20 diff --git a/2006/src/packlib/cspack/sysreq/serror.c b/2006/src/packlib/cspack/sysreq/serror.c
21 index 3667c42a..c560e499 100644
22 --- a/2006/src/packlib/cspack/sysreq/serror.c
23 +++ b/2006/src/packlib/cspack/sysreq/serror.c
24 @@ -176,15 +176,7 @@ int n;
26 else {
27 #if !defined(vms)
28 - if ((n>0) && (n<sys_nerr)) {
29 - return(sys_errlist[n]);
30 - }
31 - else {
32 - (void) sprintf(buf,"%s: %d\n",
33 - sys_serrlist[SEMAXERR+1-SEBASEOFF],
34 - n);
35 - return(buf);
36 - }
37 + return strerror(n);
38 #else /* vms */
40 * There are (were) some bugs is DEC C compilers (/OPT), just check
41 diff --git a/2006/src/packlib/cspack/sysreq/socket.c b/2006/src/packlib/cspack/sysreq/socket.c
42 index ceb5bd63..34c2a7bc 100644
43 --- a/2006/src/packlib/cspack/sysreq/socket.c
44 +++ b/2006/src/packlib/cspack/sysreq/socket.c
45 @@ -412,7 +412,7 @@ char *
46 s_errmsg() /* return last error message */
48 #if !defined(vms)
49 - return(sys_errlist[errno]);
50 + return(strerror(errno));
51 #else /* vms */
52 #if defined(MULTINET) && (MULTINET == 1)
53 return(vms_errno_string());
54 diff --git a/2006/src/packlib/kernlib/kernbit/z268/systems.c b/2006/src/packlib/kernlib/kernbit/z268/systems.c
55 index 98459459..d1ad63ed 100644
56 --- a/2006/src/packlib/kernlib/kernbit/z268/systems.c
57 +++ b/2006/src/packlib/kernlib/kernbit/z268/systems.c
58 @@ -134,7 +134,7 @@ int *ovflw;
59 #endif /* hpux */
61 if ( (ps=(FILE *)popen(command,"r"))==NULL ) {
62 - fprintf(stderr,"systems(): popen(): %s\n",sys_errlist[errno] );
63 + fprintf(stderr,"systems(): popen(): %s\n",strerror(errno) );
64 *rc= -errno;
65 *chars=0 ;
66 *l=0 ;
67 @@ -144,7 +144,7 @@ int *ovflw;
68 rcode = fread(buf, 1, buflen , ps );
69 if ( rcode < 0 ) {
70 fprintf(stderr,"systems(): pipe fread(): %s\n",
71 - sys_errlist[errno] );
72 + strerror(errno) );
73 buf[0]='\n';
74 *rc= -errno;
75 *chars=0 ;
76 diff --git a/2006/src/pawlib/paw/piafs/piafc.c b/2006/src/pawlib/paw/piafs/piafc.c
77 index b163f80c..4d8d5528 100644
78 --- a/2006/src/pawlib/paw/piafs/piafc.c
79 +++ b/2006/src/pawlib/paw/piafs/piafc.c
80 @@ -1795,10 +1795,7 @@ static void fatalperror(char *msg)
81 extern char *sys_errlist[];
82 #endif
84 - if ((unsigned) errno < sys_nerr)
85 - sprintf(buf, "%s: %s", msg, sys_errlist[errno]);
86 - else
87 - sprintf(buf, "%s: Error %d", msg, errno);
88 + sprintf(buf, "%s: %s", msg, strerror(errno));
90 fatal(buf);
92 --
93 2.25.4