* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcron.c,v 1.78 2006-05-20 16:27:10 thib Exp $ */
+ /* $Id: fcron.c,v 1.79 2007-01-01 18:51:15 thib Exp $ */
#include "fcron.h"
#include "socket.h"
#endif
-char rcs_info[] = "$Id: fcron.c,v 1.78 2006-05-20 16:27:10 thib Exp $";
+char rcs_info[] = "$Id: fcron.c,v 1.79 2007-01-01 18:51:15 thib Exp $";
void main_loop(void);
void check_signal(void);
if ( lockf(fileno(daemon_lockfp), F_TLOCK, 0) != 0 )
#endif /* ! HAVE_FLOCK */
{
- fscanf(daemon_lockfp, "%d", &otherpid);
- die_e("can't lock %s, running daemon's pid may be %d",
- pidfile, otherpid);
+ if ( fscanf(daemon_lockfp, "%d", &otherpid) >= 1 )
+ die_e("can't lock %s, running daemon's pid may be %d",
+ pidfile, otherpid);
+ else
+ die_e("can't lock %s, and unable to read running"
+ " daemon's pid", pidfile);
}
fcntl(fd, F_SETFD, 1);
rewind(daemon_lockfp);
fprintf(daemon_lockfp, "%d\n", (int) daemon_pid);
fflush(daemon_lockfp);
- ftruncate(fileno(daemon_lockfp), ftell(daemon_lockfp));
+ if ( ftruncate(fileno(daemon_lockfp), ftell(daemon_lockfp)) < 0 )
+ error_e("Unable to ftruncate(fileno(daemon_lockfp), ftell(daemon_lockfp))");
/* abandon fd and daemon_lockfp even though the file is open. we need to
* keep it open and locked, but we don't need the handles elsewhere.
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcrondyn.c,v 1.16 2006-06-05 20:00:48 thib Exp $ */
+ /* $Id: fcrondyn.c,v 1.17 2007-01-01 18:50:38 thib Exp $ */
/* fcrondyn : interact dynamically with running fcron process :
* - list jobs, with their status, next time of execution, etc
#include "allow.h"
#include "read_string.h"
-char rcs_info[] = "$Id: fcrondyn.c,v 1.16 2006-06-05 20:00:48 thib Exp $";
+char rcs_info[] = "$Id: fcrondyn.c,v 1.17 2007-01-01 18:50:38 thib Exp $";
void info(void);
void usage(void);
return ERR;
}
else {
- write(STDOUT_FILENO, buf, read_len);
+ if ( write(STDOUT_FILENO, buf, read_len) < 0 )
+ error_e("unable to write() to STDOUT_FILENO");
if ( read_len >= sizeof(END_STR) &&
strncmp(&buf[read_len-sizeof(END_STR)], END_STR, sizeof(END_STR)) == 0)
break;
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcronsighup.c,v 1.10 2006-05-20 16:22:37 thib Exp $ */
+ /* $Id: fcronsighup.c,v 1.11 2007-01-01 18:49:43 thib Exp $ */
#include "fcronsighup.h"
#include "global.h"
#include "allow.h"
-char rcs_info[] = "$Id: fcronsighup.c,v 1.10 2006-05-20 16:22:37 thib Exp $";
+char rcs_info[] = "$Id: fcronsighup.c,v 1.11 2007-01-01 18:49:43 thib Exp $";
void usage(void);
void sig_daemon(void);
pid_t pid = 0;
if ((fp = fopen(pidfile, "r")) != NULL) {
- fscanf(fp, "%d", (int *) &pid);
+ if ( fscanf(fp, "%d", (int *) &pid) < 1 )
+ error("Unable to read fcron daemon's pid (fscanf(fp,...))");
fclose(fp);
}