OSSP CVS Repository

ossp - Check-in [2429]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2429
Date: 2002-Jul-30 14:03:36 (local)
2002-Jul-30 12:03:36 (UTC)
User:thl
Branch:
Comment: allow syslog() without previous openlog()
Tickets:
Inspections:
Files:
ossp-pkg/fsl/TODO      1.5 -> 1.6     0 inserted, 1 deleted
ossp-pkg/fsl/fsl.c      1.40 -> 1.41     9 inserted, 0 deleted

ossp-pkg/fsl/TODO 1.5 -> 1.6

--- TODO 2002/07/30 11:50:00     1.5
+++ TODO 2002/07/30 12:03:36     1.6
@@ -1,3 +1,2 @@
-- allow syslog() without previous openlog()?!
 - cfg_destroy fixing and use it
 - runtime version check for sub libraries


ossp-pkg/fsl/fsl.c 1.40 -> 1.41

--- fsl.c        2002/07/30 11:50:00     1.40
+++ fsl.c        2002/07/30 12:03:36     1.41
@@ -182,6 +182,7 @@
     int           maskpri;
     int           logopt;
     int           delayopen;
+    int           openlog;
 } ctx = { 
     NULL,
     NULL,
@@ -190,6 +191,7 @@
     NULL,
     LOG_UPTO(LOG_DEBUG),
     0,
+    FALSE,
     FALSE
 };
 
@@ -620,6 +622,7 @@
 
     /* properly handle repeated execution */
     closelog();
+    ctx.openlog = TRUE;
 
     /* create OSSP l2 environment for fsl itself (internal logging) */
     if ((argl2spec = getenv("FSL_DEBUG")) == NULL)
@@ -646,6 +649,7 @@
     }
 
     /* tracing */
+    
     fsldebug(L2_LEVEL_TRACE, "openlog() ident=\"%s\", logopt=0x%.8lx, facility=0x%.8lx)", ident, logopt, facility);
 
     /* remember logopt and handle unsupported values */
@@ -777,6 +781,7 @@
     ctx.maskpri = LOG_UPTO(LOG_DEBUG);
     ctx.logopt = 0;
     ctx.delayopen = FALSE;
+    ctx.openlog = FALSE;
     return;
 }
 
@@ -816,6 +821,10 @@
     l2_result_t l2rv;
     char *cp;
     
+    /* check for previous omitted attempt of initialization */
+    if (ctx.l2_nch == NULL && !ctx.openlog)
+        openlog("fsl", 0, LOG_SYSLOG);
+
     /* check for previous proper initialization */
     if (ctx.l2_nch == NULL)
         return;

CVSTrac 2.0.1