diff -ru inn-STABLE-20051208-orig/frontends/ovdb_init.c inn-STABLE-20051208/frontends/ovdb_init.c
old
|
new
|
|
455 | 455 | case 0: |
456 | 456 | setsid(); |
457 | 457 | execl(concatpath(innconf->pathbin, "ovdb_monitor"), |
458 | | "ovdb_monitor", SPACES, NULL); |
| 458 | OVDB_M, NULL); |
459 | 459 | syswarn("cannot exec ovdb_monitor"); |
460 | 460 | _exit(1); |
461 | 461 | } |
… |
… |
|
472 | 472 | case 0: |
473 | 473 | setsid(); |
474 | 474 | execl(concatpath(innconf->pathbin, "ovdb_server"), |
475 | | "ovdb_server", SPACES, NULL); |
| 475 | OVDB_S, NULL); |
476 | 476 | syswarn("cannot exec ovdb_server"); |
477 | 477 | _exit(1); |
478 | 478 | } |
diff -ru inn-STABLE-20051208-orig/frontends/ovdb_monitor.c inn-STABLE-20051208/frontends/ovdb_monitor.c
old
|
new
|
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
286 | | int main(int argc, char **argv) |
| 286 | int main(int argc, char *argv[], char *envp[]) |
287 | 287 | { |
288 | 288 | char *pidfile; |
289 | 289 | |
290 | | setproctitle_init(argc, argv); |
| 290 | setproctitle_init(argc, argv, envp); |
291 | 291 | |
292 | 292 | openlog("ovdb_monitor", L_OPENLOG_FLAGS | LOG_PID, LOG_INN_PROG); |
293 | 293 | message_program_name = "ovdb_monitor"; |
294 | 294 | |
295 | | if(argc != 2 || strcmp(argv[1], SPACES)) |
| 295 | if(argc != 1 || strcmp(argv[0], OVDB_M)) |
296 | 296 | die("should be started by ovdb_init"); |
297 | 297 | message_handlers_warn(1, message_log_syslog_err); |
298 | 298 | message_handlers_die(1, message_log_syslog_err); |
diff -ru inn-STABLE-20051208-orig/frontends/ovdb_server.c inn-STABLE-20051208/frontends/ovdb_server.c
old
|
new
|
|
607 | 607 | } |
608 | 608 | |
609 | 609 | int |
610 | | main(int argc, char *argv[]) |
| 610 | main(int argc, char *argv[], char *envp[]) |
611 | 611 | { |
612 | 612 | int i, ret; |
613 | 613 | socklen_t salen; |
… |
… |
|
620 | 620 | struct timeval tv; |
621 | 621 | fd_set rdset; |
622 | 622 | |
623 | | setproctitle_init(argc, argv); |
| 623 | setproctitle_init(argc, argv, envp); |
624 | 624 | |
625 | 625 | openlog("ovdb_server", L_OPENLOG_FLAGS | LOG_PID, LOG_INN_PROG); |
626 | 626 | message_program_name = "ovdb_server"; |
627 | 627 | |
628 | | if(argc != 2 || strcmp(argv[1], SPACES)) |
| 628 | if(argc != 1 || strcmp(argv[0], OVDB_S)) |
629 | 629 | die("should be started by ovdb_init"); |
630 | 630 | message_handlers_warn(1, message_log_syslog_err); |
631 | 631 | message_handlers_die(1, message_log_syslog_err); |
diff -ru inn-STABLE-20051208-orig/include/portable/setproctitle.h inn-STABLE-20051208/include/portable/setproctitle.h
old
|
new
|
|
17 | 17 | #endif |
18 | 18 | |
19 | 19 | #if HAVE_SETPROCTITLE || HAVE_PSTAT |
20 | | # define setproctitle_init(argc, argv) /* empty */ |
| 20 | # define setproctitle_init(argc, argv, envp) /* empty */ |
21 | 21 | #else |
22 | | void setproctitle_init(int argc, char *argv[]); |
| 22 | void setproctitle_init(int argc, char *argv[], char *envp[]); |
23 | 23 | #endif |
24 | 24 | |
25 | 25 | #endif /* !PORTABLE_SETPROCTITLE_H */ |
diff -ru inn-STABLE-20051208-orig/innd/rc.c inn-STABLE-20051208/innd/rc.c
old
|
new
|
|
448 | 448 | void |
449 | 449 | RChandoff(int fd, HANDOFF h) |
450 | 450 | { |
451 | | const char *argv[6]; |
| 451 | const char *argv[5]; |
452 | 452 | char buff[SMBUF]; |
453 | 453 | int i; |
454 | 454 | |
… |
… |
|
472 | 472 | case HOnnrpd: argv[0] = RCnnrpd; break; |
473 | 473 | case HOnntpd: argv[0] = RCnntpd; break; |
474 | 474 | } |
475 | | argv[1] = "-s "; |
476 | | i = 2; |
| 475 | i = 1; |
477 | 476 | if (NNRPReason) { |
478 | 477 | snprintf(buff, sizeof(buff), "-r%s", NNRPReason); |
479 | 478 | argv[i++] = buff; |
diff -ru inn-STABLE-20051208-orig/lib/setproctitle.c inn-STABLE-20051208/lib/setproctitle.c
old
|
new
|
|
47 | 47 | |
48 | 48 | static char *title_start = NULL; |
49 | 49 | static char *title_end = NULL; |
| 50 | static char **xargv = NULL; |
50 | 51 | |
51 | 52 | void |
52 | | setproctitle_init(int argc, char *argv[]) |
| 53 | setproctitle_init(int argc, char *argv[], char *envp[]) |
53 | 54 | { |
| 55 | int i; |
| 56 | char **xenv; |
| 57 | extern char **environ; |
| 58 | |
54 | 59 | title_start = argv[0]; |
55 | 60 | title_end = argv[argc - 1] + strlen(argv[argc - 1]) - 1; |
| 61 | |
| 62 | xargv = argv; |
| 63 | if (!envp) |
| 64 | return; |
| 65 | |
| 66 | if (environ) { |
| 67 | for (i=0; environ[i]; i++) |
| 68 | ; |
| 69 | xenv = malloc((i+1) * sizeof(char*)); |
| 70 | if (!xenv) |
| 71 | return; |
| 72 | for (i=0; environ[i]; i++) { |
| 73 | xenv[i] = strdup(environ[i]); |
| 74 | if (!xenv[i]) { |
| 75 | for (i--; i >= 0; i--) |
| 76 | free(xenv[i]); |
| 77 | free(xenv); |
| 78 | return; |
| 79 | } |
| 80 | } |
| 81 | xenv[i] = NULL; |
| 82 | environ = xenv; |
| 83 | } |
| 84 | |
| 85 | for (i=0; envp[i]; i++) |
| 86 | title_end += strlen(envp[i]) + 1; |
| 87 | |
56 | 88 | } |
57 | 89 | |
58 | 90 | void |
… |
… |
|
68 | 100 | return; |
69 | 101 | } |
70 | 102 | |
| 103 | xargv[1] = NULL; |
| 104 | |
71 | 105 | /* setproctitle prepends the program name to its arguments. Our emulation |
72 | 106 | should therefore do the same thing. However, some operating systems |
73 | 107 | seem to do that automatically even when we completely overwrite argv, |
diff -ru inn-STABLE-20051208-orig/nnrpd/nnrpd.c inn-STABLE-20051208/nnrpd/nnrpd.c
old
|
new
|
|
783 | 783 | |
784 | 784 | /* ARGSUSED0 */ |
785 | 785 | int |
786 | | main(int argc, char *argv[]) |
| 786 | main(int argc, char *argv[], char *envp[]) |
787 | 787 | { |
788 | 788 | const char *name; |
789 | 789 | CMDENT *cp; |
… |
… |
|
829 | 829 | |
830 | 830 | int respawn = 0; |
831 | 831 | |
832 | | setproctitle_init(argc, argv); |
| 832 | setproctitle_init(argc, argv, envp); |
833 | 833 | |
834 | 834 | /* Parse arguments. Must xstrdup() optarg if used because setproctitle may |
835 | 835 | clobber it! */ |
diff -ru inn-STABLE-20051208-orig/storage/ovdb/ovdb-private.h inn-STABLE-20051208/storage/ovdb/ovdb-private.h
old
|
new
|
|
112 | 112 | #define OVDB_LOCKFN "ovdb.sem" |
113 | 113 | #define OVDB_MONITOR_PIDFILE "ovdb_monitor.pid" |
114 | 114 | #define OVDB_SERVER_PIDFILE "ovdb_server.pid" |
115 | | #define SPACES " " |
| 115 | #define OVDB_M "ovdb_monitor " |
| 116 | #define OVDB_S "ovdb_server " |
116 | 117 | |
117 | 118 | /* read server stuff */ |
118 | 119 | #define CMD_QUIT 0x01 |