commit - 17f7cea3a2932bd7836df7a03f41db2224a794ae
commit + 97ddbd299ba74881d7fda4bc0588da7b494ed1af
blob - 8cf2899a3f3de4adefcc99801b1325960c4f090f
blob + 5830c85ab86441288df899ce965b061f45d21f62
--- gotd/gotd.c
+++ gotd/gotd.c
start_child(enum gotd_procid proc_id, const char *repo_path,
char *argv0, const char *confpath, int fd, int daemonize, int verbosity)
{
- char *argv[11];
- int argc = 0;
- pid_t pid;
+ const char *argv[11];
+ int argc = 0;
+ pid_t pid;
switch (pid = fork()) {
case -1:
argv[argc++] = argv0;
switch (proc_id) {
case PROC_LISTEN:
- argv[argc++] = (char *)"-TL";
+ argv[argc++] = "-TL";
break;
case PROC_AUTH:
- argv[argc++] = (char *)"-TA";
+ argv[argc++] = "-TA";
break;
case PROC_SESSION_READ:
- argv[argc++] = (char *)"-Ts";
+ argv[argc++] = "-Ts";
break;
case PROC_SESSION_WRITE:
- argv[argc++] = (char *)"-TS";
+ argv[argc++] = "-TS";
break;
case PROC_REPO_READ:
- argv[argc++] = (char *)"-TR";
+ argv[argc++] = "-TR";
break;
case PROC_REPO_WRITE:
- argv[argc++] = (char *)"-TW";
+ argv[argc++] = "-TW";
break;
case PROC_NOTIFY:
- argv[argc++] = (char *)"-TN";
+ argv[argc++] = "-TN";
break;
default:
fatalx("invalid process id %d", proc_id);
}
- argv[argc++] = (char *)"-f";
- argv[argc++] = (char *)confpath;
+ argv[argc++] = "-f";
+ argv[argc++] = confpath;
if (repo_path) {
- argv[argc++] = (char *)"-P";
- argv[argc++] = (char *)repo_path;
+ argv[argc++] = "-P";
+ argv[argc++] = repo_path;
}
if (!daemonize)
- argv[argc++] = (char *)"-d";
+ argv[argc++] = "-d";
if (verbosity > 0)
- argv[argc++] = (char *)"-v";
+ argv[argc++] = "-v";
if (verbosity > 1)
- argv[argc++] = (char *)"-v";
+ argv[argc++] = "-v";
argv[argc++] = NULL;
- execvp(argv0, argv);
+ execvp(argv0, (char * const *)argv);
fatal("execvp");
}