From e09f4f81df3ae4cf774dcaa7044eb5cf17f4d25b Mon Sep 17 00:00:00 2001
From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sat, 26 Oct 2002 10:19:16 +0000
Subject: [PATCH] Close syslog after each write -- prevents daemon from having
 another open file descriptor

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@140 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/smartd.c   | 3 ++-
 sm5/smartd.cpp | 3 ++-
 sm5/smartd.h   | 8 +++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/sm5/smartd.c b/sm5/smartd.c
index 6680421c6..32f9f5100 100644
--- a/sm5/smartd.c
+++ b/sm5/smartd.c
@@ -39,7 +39,7 @@
 
 // CVS ID strings
 extern const char *CVSid1, *CVSid2;
-const char *CVSid3="$Id: smartd.c,v 1.34 2002/10/26 09:58:05 ballen4705 Exp $" 
+const char *CVSid3="$Id: smartd.c,v 1.35 2002/10/26 10:19:16 ballen4705 Exp $" 
 CVSID1 CVSID4 CVSID7;
 
 // This function prints either to stdout or to the syslog as needed
@@ -51,6 +51,7 @@ void printout(int priority,char *fmt, ...){
     vprintf(fmt,ap);
   else
     vsyslog(priority,fmt,ap);
+    closelog();
   va_end(ap);
   return;
 }
diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp
index c9b16d763..34abbce27 100644
--- a/sm5/smartd.cpp
+++ b/sm5/smartd.cpp
@@ -39,7 +39,7 @@
 
 // CVS ID strings
 extern const char *CVSid1, *CVSid2;
-const char *CVSid3="$Id: smartd.cpp,v 1.34 2002/10/26 09:58:05 ballen4705 Exp $" 
+const char *CVSid3="$Id: smartd.cpp,v 1.35 2002/10/26 10:19:16 ballen4705 Exp $" 
 CVSID1 CVSID4 CVSID7;
 
 // This function prints either to stdout or to the syslog as needed
@@ -51,6 +51,7 @@ void printout(int priority,char *fmt, ...){
     vprintf(fmt,ap);
   else
     vsyslog(priority,fmt,ap);
+    closelog();
   va_end(ap);
   return;
 }
diff --git a/sm5/smartd.h b/sm5/smartd.h
index 64e223941..bf0fdd3f6 100644
--- a/sm5/smartd.h
+++ b/sm5/smartd.h
@@ -23,7 +23,7 @@
  */
 
 #ifndef CVSID7
-#define CVSID7 "$Id: smartd.h,v 1.10 2002/10/26 09:38:26 ballen4705 Exp $\n"
+#define CVSID7 "$Id: smartd.h,v 1.11 2002/10/26 10:19:16 ballen4705 Exp $\n"
 #endif
 
 // Configuration file
@@ -31,13 +31,15 @@
 #define MAXLINELEN 114
 #define MAXENTRIES 64
 
-// BAD PROGRAMMING PRACTICE - GLOBAL VARIABLES SHOULD BE IN .c NOT .h
-// FILE
+// BAD PROGRAMMING - GLOBAL VARIABLES SHOULD BE IN .c NOT .h FILE
+
 /* how often SMART status is checked, in seconds */
 int checktime = 1800;
+
 // number of ATA and SCSI devices being watched
 int numatadevices;
 int numscsidevices;
+
 #define MAXATADEVICES	12
 #define MAXSCSIDEVICES	26
 
-- 
GitLab