diff options
author | netblue30 <netblue30@yahoo.com> | 2018-09-05 11:17:07 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2018-09-05 11:17:07 -0400 |
commit | d7e5a6ac35af9b1d48231c9797f229ea0afcea5a (patch) | |
tree | 36954d87369331bf971ef434ce3e44c3ec07b18b | |
parent | improve safe_fd() function for better readability and auditability (diff) | |
download | firejail-d7e5a6ac35af9b1d48231c9797f229ea0afcea5a.tar.gz firejail-d7e5a6ac35af9b1d48231c9797f229ea0afcea5a.tar.zst firejail-d7e5a6ac35af9b1d48231c9797f229ea0afcea5a.zip |
cleanup
-rw-r--r-- | src/firejail/sbox.c | 1 | ||||
-rw-r--r-- | src/libpostexecseccomp/libpostexecseccomp.c | 4 | ||||
-rwxr-xr-x | test/fcopy/fcopy.sh | 3 | ||||
-rwxr-xr-x | test/fcopy/trailing.exp | 25 | ||||
-rwxr-xr-x | test/fs/private-home-dir.exp | 2 |
5 files changed, 5 insertions, 30 deletions
diff --git a/src/firejail/sbox.c b/src/firejail/sbox.c index 1c6f3c327..10c96225a 100644 --- a/src/firejail/sbox.c +++ b/src/firejail/sbox.c | |||
@@ -139,6 +139,7 @@ int sbox_run(unsigned filter, int num, ...) { | |||
139 | exit(1); | 139 | exit(1); |
140 | } | 140 | } |
141 | dup2(fd,STDIN_FILENO); | 141 | dup2(fd,STDIN_FILENO); |
142 | close(fd); | ||
142 | } | 143 | } |
143 | else if ((filter & SBOX_ALLOW_STDIN) == 0) { | 144 | else if ((filter & SBOX_ALLOW_STDIN) == 0) { |
144 | int fd = open("/dev/null",O_RDWR, 0); | 145 | int fd = open("/dev/null",O_RDWR, 0); |
diff --git a/src/libpostexecseccomp/libpostexecseccomp.c b/src/libpostexecseccomp/libpostexecseccomp.c index de64d50c5..856adb8fe 100644 --- a/src/libpostexecseccomp/libpostexecseccomp.c +++ b/src/libpostexecseccomp/libpostexecseccomp.c | |||
@@ -32,8 +32,10 @@ static void load_seccomp(void) { | |||
32 | return; | 32 | return; |
33 | 33 | ||
34 | off_t size = lseek(fd, 0, SEEK_END); | 34 | off_t size = lseek(fd, 0, SEEK_END); |
35 | if (size <= 0) | 35 | if (size <= 0) { |
36 | close(fd); | ||
36 | return; | 37 | return; |
38 | } | ||
37 | unsigned short entries = (unsigned short) size / (unsigned short) sizeof(struct sock_filter); | 39 | unsigned short entries = (unsigned short) size / (unsigned short) sizeof(struct sock_filter); |
38 | struct sock_filter *filter = MAP_FAILED; | 40 | struct sock_filter *filter = MAP_FAILED; |
39 | if (size != 0) | 41 | if (size != 0) |
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh index b225f9ea0..78dab4986 100755 --- a/test/fcopy/fcopy.sh +++ b/test/fcopy/fcopy.sh | |||
@@ -27,7 +27,4 @@ echo "TESTING: fcopy file (test/fcopy/filecopy.exp)" | |||
27 | echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)" | 27 | echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)" |
28 | ./linkcopy.exp | 28 | ./linkcopy.exp |
29 | 29 | ||
30 | echo "TESTING: fcopy trailing char (test/copy/trailing.exp)" | ||
31 | ./trailing.exp | ||
32 | |||
33 | rm -fr dest/* | 30 | rm -fr dest/* |
diff --git a/test/fcopy/trailing.exp b/test/fcopy/trailing.exp deleted file mode 100755 index bd51a2b7b..000000000 --- a/test/fcopy/trailing.exp +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2018 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | # | ||
7 | # copy directory src to dest | ||
8 | # | ||
9 | set timeout 10 | ||
10 | spawn $env(SHELL) | ||
11 | match_max 100000 | ||
12 | |||
13 | send -- "firejail --private-etc=group,passwd,firejail/ ls /etc/firejail\r" | ||
14 | expect { | ||
15 | timeout {puts "TESTING ERROR 0\n";exit} | ||
16 | "Child process initialized" | ||
17 | } | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 0\n";exit} | ||
20 | "0ad.profile" | ||
21 | } | ||
22 | after 100 | ||
23 | |||
24 | |||
25 | puts "\nall done\n" | ||
diff --git a/test/fs/private-home-dir.exp b/test/fs/private-home-dir.exp index 320fb73fa..41820b919 100755 --- a/test/fs/private-home-dir.exp +++ b/test/fs/private-home-dir.exp | |||
@@ -64,7 +64,7 @@ sleep 1 | |||
64 | send -- "firejail --private=/etc\r" | 64 | send -- "firejail --private=/etc\r" |
65 | expect { | 65 | expect { |
66 | timeout {puts "TESTING ERROR 5\n";exit} | 66 | timeout {puts "TESTING ERROR 5\n";exit} |
67 | "private directory should be owned by the current user" | 67 | "private directory is not owned by the current user" |
68 | } | 68 | } |
69 | sleep 1 | 69 | sleep 1 |
70 | send -- "mkdir ~/_firejail_test_dir_/test_dir_2\r" | 70 | send -- "mkdir ~/_firejail_test_dir_/test_dir_2\r" |