Skip to content
Snippets Groups Projects
Commit 090126d9 authored by ballen4705's avatar ballen4705
Browse files

Backed out most of the previous changes. It's a lousy idea to fork and go

daemon before reading the config file.  It means that if there is an error
in the config file, the bad status doesn't get returned to the calling
program (like an init script).  Duh.

So this means we are stuck with two process numbers for smartd entries in syslog.
[Could be fixed by doing all error printing from config file parsing with separate
print handler, THEN printing header for normal running.  Not worth it.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@339 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 88e4e4cd
No related branches found
No related tags found
No related merge requests found
CHANGELOG for smartmontools
$Id: CHANGELOG,v 1.62 2002/12/01 06:48:14 ballen4705 Exp $
$Id: CHANGELOG,v 1.63 2002/12/01 07:07:46 ballen4705 Exp $
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
......@@ -32,11 +32,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
CURRENT RELEASE (see VERSION file in this directory):
[BA] smartd: The syslog entries how have a single process number for
smartd, not two distinct numbers. We do this by calling daemon_init()
before printing header message and before reading config file. Some
perror() entries in the latter modified to print in the correct
place.
[BA] smartd: Fixed a couple of error messages done with perror()
to redirect them as needed.
smartmontools-5.0.48
......
......@@ -47,7 +47,7 @@
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.c,v 1.77 2002/12/01 06:48:14 ballen4705 Exp $"
const char *CVSid6="$Id: smartd.c,v 1.78 2002/12/01 07:07:46 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc.
......@@ -1358,6 +1358,9 @@ void ParseOpts(int argc, char **argv){
exit(0);
}
}
// print header
printhead();
return;
}
......@@ -1442,17 +1445,13 @@ int main (int argc, char **argv){
con->veryquietmode=debugmode?0:1;
con->checksumfail=0;
// If in background as a daemon, fork and close file descriptors
if (!debugmode){
daemon_init();
}
// print header after daemon_init so right process number in syslog
printhead();
// look in configuration file CONFIGFILE (normally /etc/smartd.conf)
entries=parseconfigfile();
// If in background as a daemon, fork and close file descriptors
if (!debugmode)
daemon_init();
// setup signal handler for shutdown
if (signal(SIGINT, sighandler)==SIG_IGN)
signal(SIGINT, SIG_IGN);
......
......@@ -47,7 +47,7 @@
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.cpp,v 1.77 2002/12/01 06:48:14 ballen4705 Exp $"
const char *CVSid6="$Id: smartd.cpp,v 1.78 2002/12/01 07:07:46 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc.
......@@ -1358,6 +1358,9 @@ void ParseOpts(int argc, char **argv){
exit(0);
}
}
// print header
printhead();
return;
}
......@@ -1442,17 +1445,13 @@ int main (int argc, char **argv){
con->veryquietmode=debugmode?0:1;
con->checksumfail=0;
// If in background as a daemon, fork and close file descriptors
if (!debugmode){
daemon_init();
}
// print header after daemon_init so right process number in syslog
printhead();
// look in configuration file CONFIGFILE (normally /etc/smartd.conf)
entries=parseconfigfile();
// If in background as a daemon, fork and close file descriptors
if (!debugmode)
daemon_init();
// setup signal handler for shutdown
if (signal(SIGINT, sighandler)==SIG_IGN)
signal(SIGINT, SIG_IGN);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment