diff options
Diffstat (limited to 'libudev')
-rw-r--r-- | libudev/libudev-private.h | 4 | ||||
-rw-r--r-- | libudev/libudev-util-private.c | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index b735298c67..e90c79cb3e 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -13,6 +13,7 @@ #define _LIBUDEV_PRIVATE_H_ #include <syslog.h> +#include <signal.h> #include "libudev.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -214,7 +215,8 @@ int util_unlink_secure(struct udev *udev, const char *filename); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); 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 util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index fe8f29b3a8..dfde5a998d 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -242,7 +242,8 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, } 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}; @@ -330,6 +331,10 @@ int util_run_program(struct udev *udev, const char *command, char **envp, 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 */ |