}
int util_run_program(struct udev *udev, const char *command, char **envp,
- char *result, size_t ressize, size_t *reslen)
+ char *result, size_t ressize, size_t *reslen,
+ const sigset_t *sigmask)
{
int status;
int outpipe[2] = {-1, -1};
/* do not separate quotes */
pos++;
argv[i] = strsep(&pos, "\'");
- while (pos != NULL && pos[0] == ' ')
- pos++;
+ if (pos != NULL)
+ while (pos[0] == ' ')
+ pos++;
} else {
argv[i] = strsep(&pos, " ");
+ if (pos != NULL)
+ while (pos[0] == ' ')
+ pos++;
}
dbg(udev, "arg[%i] '%s'\n", i, argv[i]);
i++;
dup2(errpipe[WRITE_END], STDERR_FILENO);
close(errpipe[WRITE_END]);
}
+
+ if (sigmask)
+ sigprocmask(SIG_BLOCK, sigmask, NULL);
+
execve(argv[0], argv, envp);
if (errno == ENOENT || errno == ENOTDIR) {
/* may be on a filesystem which is not mounted right now */