summaryrefslogtreecommitdiff
path: root/recipes/mgetty/mgetty-1.1.30/45-logfile.c
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/mgetty/mgetty-1.1.30/45-logfile.c
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/mgetty/mgetty-1.1.30/45-logfile.c')
-rw-r--r--recipes/mgetty/mgetty-1.1.30/45-logfile.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/recipes/mgetty/mgetty-1.1.30/45-logfile.c b/recipes/mgetty/mgetty-1.1.30/45-logfile.c
new file mode 100644
index 0000000000..a14a380f7a
--- /dev/null
+++ b/recipes/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