Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37744121
en ru br
ALT Linux repos
S:1.2.1-alt1
5.0: 1.1.35-alt1.1
4.1: 1.1.35-alt1
4.0: 1.1.31-alt1.1
3.0: 1.1.31-alt1

Group :: Communications
RPM: mgetty

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: mgetty-1.1.31-logfile.c.diff
Download


--- mgetty-1.1.31.orig/logfile.c	2005-02-05 22:52:34.595987224 +0100
+++ mgetty-1.1.31/logfile.c	2005-02-05 23:03:17.159302752 +0100
@@ -58,10 +58,10 @@
 /* Most systems have these variables but do not declare them. On many
    of those systems that _do_ declare them, it won't hurt */
 
-extern int sys_nerr;
-#if !defined(__NetBSD__) && !defined( __FreeBSD__ ) && !defined(__OpenBSD__) && !defined(__GLIBC__) && !defined(__MACH__)
-extern char *sys_errlist[];
-#endif
+/* extern int sys_nerr; */
+/* #if !defined(__NetBSD__) && !defined( __FreeBSD__ ) && !defined(__OpenBSD__) && !defined(__GLIBC__) && !defined(__MACH__) */
+/* extern char *sys_errlist[]; */
+/* #endif */
 
 /* Interactive Unix is a little bit braindead - does not have atexit(),
  */
@@ -211,6 +211,7 @@
 va_list pvar;
 int     errnr;
 char * p;
+char *error_string;
 static int first_open = TRUE;
 
     if ( level > log_level )	/* log level high enough? */
@@ -327,12 +328,20 @@
     }
     else		/* ERROR or FATAL */
     {
+	error_string = strerror (errnr);
+	if ( error_string == NULL )
+	{
+		if ( errno == EINVAL )
+			error_string = "<error not in list>";
+		else
+			error_string = "<error calling strerror()>";
+	}
+	
 	fprintf(log_fp, "\n%02d/%02d %02d:%02d:%02d %s %s: %s",
 		             tm->tm_mon+1,  tm->tm_mday,
 			     tm->tm_hour, tm->tm_min, tm->tm_sec,
 		             log_infix, ws,
-			     ( errnr <= sys_nerr ) ? sys_errlist[errnr]:
-			     "<error not in list>" );
+			     strerror (errnr));
 #ifdef SYSLOG
 	syslog( level == L_FATAL? LOG_ALERT: LOG_ERR, "%s: %m", ws );
 #endif
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin