--- 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 = ""; + else + error_string = ""; + } + 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]: - "" ); + strerror (errnr)); #ifdef SYSLOG syslog( level == L_FATAL? LOG_ALERT: LOG_ERR, "%s: %m", ws ); #endif