diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -2,6 +2,7 @@ | |||
2 | #include <unistd.h> | 2 | #include <unistd.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <signal.h> | 4 | #include <signal.h> |
5 | #include <string.h> | ||
5 | 6 | ||
6 | char *progname; | 7 | char *progname; |
7 | 8 | ||
@@ -174,7 +175,6 @@ main(int argc, char **argv) | |||
174 | pidfile_check(pid_file); | 175 | pidfile_check(pid_file); |
175 | 176 | ||
176 | if (!foreground) { | 177 | if (!foreground) { |
177 | int i; | ||
178 | if (daemon(0, 1)) { | 178 | if (daemon(0, 1)) { |
179 | fprintf(stderr, "%s: daemon: %s\n", | 179 | fprintf(stderr, "%s: daemon: %s\n", |
180 | progname, strerror(errno)); | 180 | progname, strerror(errno)); |
@@ -230,7 +230,6 @@ pidfile_create(char const *pid_file) | |||
230 | if (!fp) { | 230 | if (!fp) { |
231 | snmp_log(LOG_CRIT, | 231 | snmp_log(LOG_CRIT, |
232 | "cannot create pidfile `%s': %s\n", | 232 | "cannot create pidfile `%s': %s\n", |
233 | progname, | ||
234 | pid_file, | 233 | pid_file, |
235 | strerror(errno)); | 234 | strerror(errno)); |
236 | exit(1); | 235 | exit(1); |
@@ -255,7 +254,7 @@ pidfile_check(char const *pid_file) | |||
255 | if (fp) { | 254 | if (fp) { |
256 | if (fscanf(fp, "%lu", &pid) != 1) { | 255 | if (fscanf(fp, "%lu", &pid) != 1) { |
257 | snmp_log(LOG_ERR, | 256 | snmp_log(LOG_ERR, |
258 | "cannot get pid from pidfile `%s'\n", | 257 | "cannot get pid from pidfile `%s': %s\n", |
259 | pid_file, | 258 | pid_file, |
260 | strerror(errno)); | 259 | strerror(errno)); |
261 | } else { | 260 | } else { |