commit:     cb2c45a3c092de617fa037089599e624a758aea9
Author:     Alexander Vershilov <alexander.vershilov <AT> gmail <DOT> com>
AuthorDate: Wed Oct 29 20:16:35 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Nov  1 23:32:26 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=cb2c45a3

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

---
 src/librc/librc-daemon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 190a014..02aff5a 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -556,8 +556,8 @@ rc_service_daemons_crashed(const char *service)
 
                char *ch_root = rc_service_value_get(basename_c(service), 
"chroot");
                char *spidfile = pidfile;
-               if (ch_root) {
-                       spidfile = malloc(strlen(ch_root) + strlen(pidfile));
+               if (ch_root && pidfile) {
+                       spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 
1);
                        strcpy(spidfile, ch_root);
                        strcat(spidfile, pidfile);
                }

Reply via email to