mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Added check_config_file()
SVN revision: 628
This commit is contained in:
parent
42f61ae981
commit
debf12b1f4
68
src/elogd.c
68
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.158 2003/11/20 16:36:05 midas
|
||||||
|
Added check_config_file()
|
||||||
|
|
||||||
Revision 1.157 2003/11/20 16:22:54 midas
|
Revision 1.157 2003/11/20 16:22:54 midas
|
||||||
Removed printf()
|
Removed printf()
|
||||||
|
|
||||||
@ -1461,6 +1464,34 @@ INT ss_daemon_init()
|
|||||||
char *cfgbuffer;
|
char *cfgbuffer;
|
||||||
time_t cfgfile_mtime = 0;
|
time_t cfgfile_mtime = 0;
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void check_config_file()
|
||||||
|
{
|
||||||
|
struct stat cfg_stat;
|
||||||
|
|
||||||
|
/* force re-read configuration file if changed */
|
||||||
|
if (stat(config_file, &cfg_stat) == 0)
|
||||||
|
{
|
||||||
|
if (cfgfile_mtime < cfg_stat.st_mtime)
|
||||||
|
{
|
||||||
|
cfgfile_mtime = cfg_stat.st_mtime;
|
||||||
|
|
||||||
|
if (cfgbuffer)
|
||||||
|
{
|
||||||
|
free(cfgbuffer);
|
||||||
|
cfgbuffer = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
perror("Cannot stat() config file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
int getcfg(char *group, char *param, char *value)
|
int getcfg(char *group, char *param, char *value)
|
||||||
{
|
{
|
||||||
char *str, *p, *pstr;
|
char *str, *p, *pstr;
|
||||||
@ -1865,6 +1896,7 @@ int n;
|
|||||||
void check_config()
|
void check_config()
|
||||||
{
|
{
|
||||||
check_language();
|
check_language();
|
||||||
|
check_config_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
@ -6297,6 +6329,10 @@ char str[80];
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(fh);
|
close(fh);
|
||||||
|
|
||||||
|
/* language might have changed, so re-read config file */
|
||||||
|
check_config();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13256,7 +13292,6 @@ int lsock, len, flag, content_length, header_length;
|
|||||||
struct hostent *phe;
|
struct hostent *phe;
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
struct stat cfg_stat;
|
|
||||||
char *net_buffer = NULL;
|
char *net_buffer = NULL;
|
||||||
int net_buffer_size;
|
int net_buffer_size;
|
||||||
|
|
||||||
@ -13681,14 +13716,6 @@ int net_buffer_size;
|
|||||||
puts(net_buffer);
|
puts(net_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OS_WINNT
|
|
||||||
|
|
||||||
/* under windows, check if configuration changed (via fstat()) once each access */
|
|
||||||
check_config();
|
|
||||||
|
|
||||||
/* under unix, rely on "kill -HUP elogd" */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* initialize parametr array */
|
/* initialize parametr array */
|
||||||
initparam();
|
initparam();
|
||||||
|
|
||||||
@ -13851,24 +13878,13 @@ int net_buffer_size;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force re-read configuration file if changed */
|
#ifdef OS_WINNT
|
||||||
if (stat(config_file, &cfg_stat) == 0)
|
|
||||||
{
|
|
||||||
if (cfgfile_mtime < cfg_stat.st_mtime)
|
|
||||||
{
|
|
||||||
cfgfile_mtime = cfg_stat.st_mtime;
|
|
||||||
|
|
||||||
if (cfgbuffer)
|
/* under windows, check if configuration changed (via stat()) once each access */
|
||||||
{
|
check_config();
|
||||||
free(cfgbuffer);
|
|
||||||
cfgbuffer = NULL;
|
/* under unix, rely on "kill -HUP elogd" */
|
||||||
}
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
perror("Cannot stat() config file");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check if logbook exists */
|
/* check if logbook exists */
|
||||||
for (i=0 ; ; i++)
|
for (i=0 ; ; i++)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user