Tweak the last commit and fix a valgrind error.
This commit is contained in:
parent
aec83494d6
commit
50cff8ebc8
@ -1108,7 +1108,7 @@ int runscript(int argc, char **argv)
|
|||||||
char lnk[PATH_MAX];
|
char lnk[PATH_MAX];
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
size_t ll;
|
size_t ll;
|
||||||
char *dir, *save;
|
char *dir, *save = NULL;
|
||||||
const char *file;
|
const char *file;
|
||||||
int depoptions = RC_DEP_TRACE;
|
int depoptions = RC_DEP_TRACE;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
@ -1145,8 +1145,7 @@ int runscript(int argc, char **argv)
|
|||||||
file = basename_c(argv[1]);
|
file = basename_c(argv[1]);
|
||||||
else
|
else
|
||||||
file = basename_c(lnk);
|
file = basename_c(lnk);
|
||||||
free(save);
|
dir = save;
|
||||||
dir = dirname(path);
|
|
||||||
} else
|
} else
|
||||||
file = basename_c(argv[1]);
|
file = basename_c(argv[1]);
|
||||||
ll = strlen(dir) + strlen(file) + 2;
|
ll = strlen(dir) + strlen(file) + 2;
|
||||||
@ -1156,6 +1155,7 @@ int runscript(int argc, char **argv)
|
|||||||
free(service);
|
free(service);
|
||||||
service = xstrdup(lnk);
|
service = xstrdup(lnk);
|
||||||
}
|
}
|
||||||
|
free(save);
|
||||||
}
|
}
|
||||||
if (!service)
|
if (!service)
|
||||||
service = xstrdup(path);
|
service = xstrdup(path);
|
||||||
@ -1200,11 +1200,15 @@ int runscript(int argc, char **argv)
|
|||||||
if (rc_conf_yesno("rc_parallel")) {
|
if (rc_conf_yesno("rc_parallel")) {
|
||||||
/* Get the longest service name */
|
/* Get the longest service name */
|
||||||
services = rc_services_in_runlevel(NULL);
|
services = rc_services_in_runlevel(NULL);
|
||||||
|
if (services) {
|
||||||
TAILQ_FOREACH(svc, services, entries) {
|
TAILQ_FOREACH(svc, services, entries) {
|
||||||
ll = strlen(svc->value);
|
ll = strlen(svc->value);
|
||||||
if (ll > l)
|
if (ll > l)
|
||||||
l = ll;
|
l = ll;
|
||||||
}
|
}
|
||||||
|
rc_stringlist_free(services);
|
||||||
|
services = NULL;
|
||||||
|
} else l = strlen(applet);
|
||||||
|
|
||||||
/* Make our prefix string */
|
/* Make our prefix string */
|
||||||
prefix = xmalloc(sizeof(char) * l + 1);
|
prefix = xmalloc(sizeof(char) * l + 1);
|
||||||
@ -1292,6 +1296,7 @@ int runscript(int argc, char **argv)
|
|||||||
prefix = NULL;
|
prefix = NULL;
|
||||||
svc_exec(optarg, NULL);
|
svc_exec(optarg, NULL);
|
||||||
eprefix(save);
|
eprefix(save);
|
||||||
|
prefix = save;
|
||||||
} else if (strcmp(optarg, "ineed") == 0 ||
|
} else if (strcmp(optarg, "ineed") == 0 ||
|
||||||
strcmp(optarg, "iuse") == 0 ||
|
strcmp(optarg, "iuse") == 0 ||
|
||||||
strcmp(optarg, "needsme") == 0 ||
|
strcmp(optarg, "needsme") == 0 ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user