]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
spawn: show permissions problem with kill, issue #4774
authorJaroslav Kysela <perex@perex.cz>
Fri, 23 Nov 2018 09:38:16 +0000 (10:38 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 23 Nov 2018 09:38:16 +0000 (10:38 +0100)
src/spawn.c

index 41b8e1ae4902b2dc1673cf0c9a2c5188cae28017..0e25c4634a4a12f96f2539919c9ecb0abc014997 100644 (file)
@@ -302,7 +302,9 @@ spawn_reaper(void)
   LIST_FOREACH(s, &spawns, link)
     if (s->killed && s->killed < mclk()) {
       /* kill the whole process group */
-      kill(-(s->pid), SIGKILL);
+      r = kill(-(s->pid), SIGKILL);
+      if (r && errno == EPERM)
+        tvherror(LS_SPAWN, "Unable to kill task pid %d (not enough permissions)", s->pid);
     }
   pthread_mutex_unlock(&spawn_mutex);
 }
@@ -328,8 +330,11 @@ spawn_kill(pid_t pid, int sig, int timeout)
         s->killed = mclk() + sec2mono(MINMAX(timeout, 5, 3600));
       /* kill the whole process group */
       r = kill(-pid, sig);
-      if (r < 0)
+      if (r < 0) {
+        if (errno == EPERM)
+          tvherror(LS_SPAWN, "Unable to kill task pid %d (not enough permissions)", s->pid);
         r = -errno;
+      }
     }
     pthread_mutex_unlock(&spawn_mutex);
   }