diff -Nru mgetty-1.1.35.orig/logfile.c mgetty-1.1.35/logfile.c --- mgetty-1.1.35.orig/logfile.c 2005-11-26 15:48:16.000000000 +0200 +++ mgetty-1.1.35/logfile.c 2006-03-12 19:30:46.556528500 +0200 @@ -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 */ -#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(), */ @@ -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