aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/shutdown.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-02-19 14:57:58 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-02-19 14:57:58 -0500
commit02a66f7e4086097a98dfdac0b47c9909908360a0 (patch)
tree443fb269e84c89842965677386260e71b85de227 /src/firejail/shutdown.c
parentmoved sandbox name to /run/firejail/name/<PID> (diff)
downloadfirejail-02a66f7e4086097a98dfdac0b47c9909908360a0.tar.gz
firejail-02a66f7e4086097a98dfdac0b47c9909908360a0.tar.zst
firejail-02a66f7e4086097a98dfdac0b47c9909908360a0.zip
euid switching
Diffstat (limited to 'src/firejail/shutdown.c')
-rw-r--r--src/firejail/shutdown.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/firejail/shutdown.c b/src/firejail/shutdown.c
index edaac7eb9..c88683aaa 100644
--- a/src/firejail/shutdown.c
+++ b/src/firejail/shutdown.c
@@ -24,6 +24,7 @@
24#include <sys/prctl.h> 24#include <sys/prctl.h>
25 25
26void shut_name(const char *name) { 26void shut_name(const char *name) {
27 EUID_ASSERT();
27 if (!name || strlen(name) == 0) { 28 if (!name || strlen(name) == 0) {
28 fprintf(stderr, "Error: invalid sandbox name\n"); 29 fprintf(stderr, "Error: invalid sandbox name\n");
29 exit(1); 30 exit(1);
@@ -39,6 +40,8 @@ void shut_name(const char *name) {
39} 40}
40 41
41void shut(pid_t pid) { 42void shut(pid_t pid) {
43 EUID_ASSERT();
44
42 pid_t parent = pid; 45 pid_t parent = pid;
43 // if the pid is that of a firejail process, use the pid of a child process inside the sandbox 46 // if the pid is that of a firejail process, use the pid of a child process inside the sandbox
44 char *comm = pid_proc_comm(pid); 47 char *comm = pid_proc_comm(pid);
@@ -73,6 +76,7 @@ void shut(pid_t pid) {
73 } 76 }
74 } 77 }
75 78
79 EUID_ROOT();
76 printf("Sending SIGTERM to %u\n", pid); 80 printf("Sending SIGTERM to %u\n", pid);
77 kill(pid, SIGTERM); 81 kill(pid, SIGTERM);
78 sleep(2); 82 sleep(2);