aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/ls.c
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2018-08-11 23:32:40 +0200
committerLibravatar smitsohu <smitsohu@gmail.com>2018-08-11 23:32:40 +0200
commitf8762bcff754911bc4a2a2c8d998f5ba93f4a384 (patch)
treec40ce67b5b98c93de75f14626ab78228e69e8dda /src/firejail/ls.c
parentclear all warnings from cppcheck static code analysis (diff)
downloadfirejail-f8762bcff754911bc4a2a2c8d998f5ba93f4a384.tar.gz
firejail-f8762bcff754911bc4a2a2c8d998f5ba93f4a384.tar.zst
firejail-f8762bcff754911bc4a2a2c8d998f5ba93f4a384.zip
various small improvements, fixes, nitpicks
Diffstat (limited to 'src/firejail/ls.c')
-rw-r--r--src/firejail/ls.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/firejail/ls.c b/src/firejail/ls.c
index 79e4b679b..601cab4f8 100644
--- a/src/firejail/ls.c
+++ b/src/firejail/ls.c
@@ -198,6 +198,10 @@ char *expand_path(const char *path) {
198 } 198 }
199 else { 199 else {
200 // assume the file is in current working directory 200 // assume the file is in current working directory
201 if (!cfg.cwd) {
202 fprintf(stderr, "Error: current working directory has been deleted\n");
203 exit(1);
204 }
201 if (asprintf(&fname, "%s/%s", cfg.cwd, path) == -1) 205 if (asprintf(&fname, "%s/%s", cfg.cwd, path) == -1)
202 errExit("asprintf"); 206 errExit("asprintf");
203 } 207 }
@@ -206,6 +210,7 @@ char *expand_path(const char *path) {
206 210
207void sandboxfs(int op, pid_t pid, const char *path1, const char *path2) { 211void sandboxfs(int op, pid_t pid, const char *path1, const char *path2) {
208 EUID_ASSERT(); 212 EUID_ASSERT();
213 assert(path1);
209 214
210 // if the pid is that of a firejail process, use the pid of the first child process 215 // if the pid is that of a firejail process, use the pid of the first child process
211 EUID_ROOT(); 216 EUID_ROOT();