static void exit_hook(int exit_code)
{
- const char *argv[3];
pid_t pid;
-
- argv[0] = OPT_STRING_VAL(DSS, EXIT_HOOK);
- argv[1] = dss_strerror(-exit_code);
- argv[2] = NULL;
-
- DSS_NOTICE_LOG(("executing %s %s\n", argv[0], argv[1]));
- dss_exec(&pid, argv[0], (char **)argv);
+ char **argv, *tmp = dss_strdup(OPT_STRING_VAL(DSS, EXIT_HOOK));
+ unsigned n = split_args(tmp, &argv, " \t");
+
+ n++;
+ argv = dss_realloc(argv, (n + 1) * sizeof(char *));
+ argv[n - 1] = dss_strdup(dss_strerror(-exit_code));
+ argv[n] = NULL;
+ dss_exec(&pid, argv[0], argv);
+ free(argv[n - 1]);
+ free(argv);
+ free(tmp);
}
static void lock_dss_or_die(void)