chiark / gitweb /
reset process priority before executing RUN+=
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 12 May 2010 06:46:56 +0000 (08:46 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 12 May 2010 06:46:56 +0000 (08:46 +0200)
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=581235

libudev/libudev-private.h
libudev/libudev-util-private.c
udev/udev-event.c
udev/udev-rules.c

index 7132357..3758c5b 100644 (file)
@@ -217,7 +217,7 @@ 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,
-                    const sigset_t *sigmask);
+                    const sigset_t *sigmask, bool reset_prio);
 int util_resolve_subsys_kernel(struct udev *udev, const char *string,
                                      char *result, size_t maxsize, int read_value);
 
index c05c157..8c53512 100644 (file)
@@ -254,7 +254,7 @@ 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,
-                    const sigset_t *sigmask)
+                    const sigset_t *sigmask, bool reset_prio)
 {
        int status;
        int outpipe[2] = {-1, -1};
@@ -349,6 +349,8 @@ int util_run_program(struct udev *udev, const char *command, char **envp,
 
                if (sigmask)
                        sigprocmask(SIG_SETMASK, sigmask, NULL);
+               if (reset_prio)
+                       setpriority(PRIO_PROCESS, 0, 0);
 
                execve(argv[0], argv, envp);
                if (errno == ENOENT || errno == ENOTDIR) {
index 1be3f74..bcd0a8f 100644 (file)
@@ -677,7 +677,7 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask)
 
                        udev_event_apply_format(event, cmd, program, sizeof(program));
                        envp = udev_device_get_properties_envp(event->dev);
-                       if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) {
+                       if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask, true) != 0) {
                                if (udev_list_entry_get_flags(list_entry))
                                        err = -1;
                        }
index b58ea8c..8fc804a 100644 (file)
@@ -747,7 +747,7 @@ static int import_program_into_properties(struct udev_device *dev, const char *p
        char *line;
 
        envp = udev_device_get_properties_envp(dev);
-       if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL) != 0)
+       if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL, false) != 0)
                return -1;
 
        line = result;
@@ -2255,7 +2255,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                                     program,
                                     &rules->buf[rule->rule.filename_off],
                                     rule->rule.filename_line);
-                               if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL) != 0) {
+                               if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL, false) != 0) {
                                        if (cur->key.op != OP_NOMATCH)
                                                goto nomatch;
                                } else {