Fix incorrect handling of chroot option.

Fixes #28.

X-Gentoo-Bug: #527370
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=527370
This commit is contained in:
Alexander Vershilov 2014-10-29 23:16:35 +03:00 committed by William Hubbs
parent 0bfde472d0
commit be952bebb3

View File

@ -556,8 +556,8 @@ rc_service_daemons_crashed(const char *service)
char *ch_root = rc_service_value_get(basename_c(service), "chroot"); char *ch_root = rc_service_value_get(basename_c(service), "chroot");
char *spidfile = pidfile; char *spidfile = pidfile;
if (ch_root) { if (ch_root && pidfile) {
spidfile = malloc(strlen(ch_root) + strlen(pidfile)); spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
strcpy(spidfile, ch_root); strcpy(spidfile, ch_root);
strcat(spidfile, pidfile); strcat(spidfile, pidfile);
} }