]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Fix the exit hook.
authorAndre Noll <maan@systemlinux.org>
Wed, 21 May 2008 14:36:13 +0000 (16:36 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 21 May 2008 14:36:13 +0000 (16:36 +0200)
As dss_exec_cmdline_pid() uses the space character as a separator
to split the command line, the words of the error message were
passed as separate parameters to the exit hook.

Use dss_exec() directly to avoid this flaw, i.e. to pass the full
error message as $1 to the exit hook.

dss.c

diff --git a/dss.c b/dss.c
index b27bdf6604d14f44dfa34d402e1c22f6e37055ae..7a46eed23531dd2f3dfa657bce877414ee5b2a0c 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -826,16 +826,13 @@ out:
 static void exit_hook(int exit_code)
 {
        int fds[3] = {0, 0, 0};
 static void exit_hook(int exit_code)
 {
        int fds[3] = {0, 0, 0};
-       char *cmd;
+       char *argv[] = {conf.exit_hook_arg, dss_strerror(-exit_code), NULL};
        pid_t pid;
 
        if (!conf.exit_hook_given)
                return;
        pid_t pid;
 
        if (!conf.exit_hook_given)
                return;
-       cmd = make_message("%s %s", conf.exit_hook_arg,
-               dss_strerror(-exit_code));
-       DSS_NOTICE_LOG("executing %s\n", cmd);
-       dss_exec_cmdline_pid(&pid, cmd, fds);
-       free(cmd);
+       DSS_NOTICE_LOG("executing %s %s\n", argv[0], argv[1]);
+       dss_exec(&pid, conf.exit_hook_arg, argv, fds);
 }
 
 static int com_run(void)
 }
 
 static int com_run(void)