forked from mirrors/nixpkgs
cernlib: fix build w/glibc-2.32
This commit is contained in:
parent
c60a09b498
commit
4ba59baf97
|
@ -0,0 +1,94 @@
|
|||
From a69607c511b6da94cde477283b129cbc9cfdd5a3 Mon Sep 17 00:00:00 2001
|
||||
From: Maximilian Bosch <maximilian@mbosch.me>
|
||||
Date: Tue, 11 Aug 2020 12:32:06 +0200
|
||||
Subject: [PATCH] Use `strerror` rather than `sys_errlist` to fix compilation
|
||||
w/glibc-2.32
|
||||
|
||||
To quote the release-notes[1]:
|
||||
|
||||
All programs should use
|
||||
strerror or strerror_r instead.
|
||||
|
||||
[1] https://sourceware.org/pipermail/libc-announce/2020/000029.html
|
||||
---
|
||||
2006/src/packlib/cspack/sysreq/serror.c | 10 +---------
|
||||
2006/src/packlib/cspack/sysreq/socket.c | 2 +-
|
||||
2006/src/packlib/kernlib/kernbit/z268/systems.c | 4 ++--
|
||||
2006/src/pawlib/paw/piafs/piafc.c | 5 +----
|
||||
4 files changed, 5 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/2006/src/packlib/cspack/sysreq/serror.c b/2006/src/packlib/cspack/sysreq/serror.c
|
||||
index 3667c42a..c560e499 100644
|
||||
--- a/2006/src/packlib/cspack/sysreq/serror.c
|
||||
+++ b/2006/src/packlib/cspack/sysreq/serror.c
|
||||
@@ -176,15 +176,7 @@ int n;
|
||||
}
|
||||
else {
|
||||
#if !defined(vms)
|
||||
- if ((n>0) && (n<sys_nerr)) {
|
||||
- return(sys_errlist[n]);
|
||||
- }
|
||||
- else {
|
||||
- (void) sprintf(buf,"%s: %d\n",
|
||||
- sys_serrlist[SEMAXERR+1-SEBASEOFF],
|
||||
- n);
|
||||
- return(buf);
|
||||
- }
|
||||
+ return strerror(n);
|
||||
#else /* vms */
|
||||
/*
|
||||
* There are (were) some bugs is DEC C compilers (/OPT), just check
|
||||
diff --git a/2006/src/packlib/cspack/sysreq/socket.c b/2006/src/packlib/cspack/sysreq/socket.c
|
||||
index ceb5bd63..34c2a7bc 100644
|
||||
--- a/2006/src/packlib/cspack/sysreq/socket.c
|
||||
+++ b/2006/src/packlib/cspack/sysreq/socket.c
|
||||
@@ -412,7 +412,7 @@ char *
|
||||
s_errmsg() /* return last error message */
|
||||
{
|
||||
#if !defined(vms)
|
||||
- return(sys_errlist[errno]);
|
||||
+ return(strerror(errno));
|
||||
#else /* vms */
|
||||
#if defined(MULTINET) && (MULTINET == 1)
|
||||
return(vms_errno_string());
|
||||
diff --git a/2006/src/packlib/kernlib/kernbit/z268/systems.c b/2006/src/packlib/kernlib/kernbit/z268/systems.c
|
||||
index 98459459..d1ad63ed 100644
|
||||
--- a/2006/src/packlib/kernlib/kernbit/z268/systems.c
|
||||
+++ b/2006/src/packlib/kernlib/kernbit/z268/systems.c
|
||||
@@ -134,7 +134,7 @@ int *ovflw;
|
||||
#endif /* hpux */
|
||||
|
||||
if ( (ps=(FILE *)popen(command,"r"))==NULL ) {
|
||||
- fprintf(stderr,"systems(): popen(): %s\n",sys_errlist[errno] );
|
||||
+ fprintf(stderr,"systems(): popen(): %s\n",strerror(errno) );
|
||||
*rc= -errno;
|
||||
*chars=0 ;
|
||||
*l=0 ;
|
||||
@@ -144,7 +144,7 @@ int *ovflw;
|
||||
rcode = fread(buf, 1, buflen , ps );
|
||||
if ( rcode < 0 ) {
|
||||
fprintf(stderr,"systems(): pipe fread(): %s\n",
|
||||
- sys_errlist[errno] );
|
||||
+ strerror(errno) );
|
||||
buf[0]='\n';
|
||||
*rc= -errno;
|
||||
*chars=0 ;
|
||||
diff --git a/2006/src/pawlib/paw/piafs/piafc.c b/2006/src/pawlib/paw/piafs/piafc.c
|
||||
index b163f80c..4d8d5528 100644
|
||||
--- a/2006/src/pawlib/paw/piafs/piafc.c
|
||||
+++ b/2006/src/pawlib/paw/piafs/piafc.c
|
||||
@@ -1795,10 +1795,7 @@ static void fatalperror(char *msg)
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
||||
- if ((unsigned) errno < sys_nerr)
|
||||
- sprintf(buf, "%s: %s", msg, sys_errlist[errno]);
|
||||
- else
|
||||
- sprintf(buf, "%s: Error %d", msg, errno);
|
||||
+ sprintf(buf, "%s: %s", msg, strerror(errno));
|
||||
|
||||
fatal(buf);
|
||||
}
|
||||
--
|
||||
2.25.4
|
||||
|
|
@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
|
|||
nativeBuildInputs = [ gnumake imake makedepend ];
|
||||
sourceRoot = ".";
|
||||
|
||||
patches = [ ./patch.patch ];
|
||||
patches = [ ./patch.patch ./0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace 2006/src/config/site.def \
|
||||
|
|
Loading…
Reference in a new issue