diff options
author | Koen Kooi <koen@openembedded.org> | 2005-06-30 08:19:37 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-06-30 08:19:37 +0000 |
commit | c8e5702127e507e82e6f68a4b8c546803accea9d (patch) | |
tree | 00583491f40ecc640f2b28452af995e3a63a09d7 /packages/mgetty/mgetty-1.1.30/45-logfile.c | |
parent | 87ec8ca4d2e2eb4d1c1e1e1a6b46a395d56805b9 (diff) |
import clean BK tree at cset 1.3670
Diffstat (limited to 'packages/mgetty/mgetty-1.1.30/45-logfile.c')
-rw-r--r-- | packages/mgetty/mgetty-1.1.30/45-logfile.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/mgetty/mgetty-1.1.30/45-logfile.c b/packages/mgetty/mgetty-1.1.30/45-logfile.c index e69de29bb2..a14a380f7a 100644 --- a/packages/mgetty/mgetty-1.1.30/45-logfile.c +++ b/packages/mgetty/mgetty-1.1.30/45-logfile.c @@ -0,0 +1,52 @@ +--- mgetty-1.1.30.orig/logfile.c 2002-11-25 08:08:26.000000000 -0500 ++++ mgetty-1.1.30/logfile.c 2003-04-28 00:08:35.000000000 -0400 +@@ -56,10 +56,14 @@ + /* 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 ++/* commented in by was@debian.org on Wed, 27 Nov 2002 01:15:11 -0500 ++ because sys_nerr and sys_errlist are deprecated. strerror() is used ++ instead below.*/ ++ ++/* 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(), + */ +@@ -209,6 +213,7 @@ + va_list pvar; + int errnr; + char * p; ++char *error_string; + static int first_open = TRUE; + + if ( level > log_level ) /* log level high enough? */ +@@ -325,12 +330,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 |