Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37704482
en ru br
Репозитории ALT
S:1.2.1-alt1
5.1: 1.1.35-alt2
4.1: 1.1.35-alt1
4.0: 1.1.31-alt1.1
3.0: 1.1.31-alt1
www.altlinux.org/Changes

Группа :: Коммуникации
Пакет: mgetty

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: mgetty-1.1.35-strerror.patch
Скачать


diff --git a/mgetty/logfile.c b/mgetty/logfile.c
index e0951cb..47e543c 100644
--- a/mgetty/logfile.c
+++ b/mgetty/logfile.c
@@ -58,10 +58,10 @@ extern int atexit _PROTO(( void (*)(void) ));
 /* Most systems have these variables but do not declare them. On many
    of those systems that _do_ declare them, it won't hurt */
 
-#if !defined(__NetBSD__) && !defined( __FreeBSD__ ) && !defined(__OpenBSD__) && !defined(__GLIBC__) && !defined(__MACH__)
+/*#if !defined(__NetBSD__) && !defined( __FreeBSD__ ) && !defined(__OpenBSD__) && !defined(__GLIBC__) && !defined(__MACH__)
 extern int sys_nerr;
 extern char *sys_errlist[];
-#endif
+#endif*/
 
 /* Interactive Unix is a little bit braindead - does not have atexit(),
  */
@@ -212,6 +212,7 @@ struct tm *tm;
 va_list pvar;
 int     errnr;
 char * p;
+char *error_string;
 static int first_open = TRUE;
 
     if ( level > log_level )	/* log level high enough? */
@@ -328,12 +329,20 @@ static int first_open = TRUE;
     }
     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
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin