diff options
author | smitsohu <smitsohu@gmail.com> | 2020-08-27 22:37:38 +0200 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2020-08-27 22:37:38 +0200 |
commit | b80014ad573b096a488e08b299cbe60ebe713d18 (patch) | |
tree | 30684d8841e26e146e56a1c9907b13b4d1abb51e | |
parent | whitelist-var-common.inc: fix certificate verification (diff) | |
download | firejail-b80014ad573b096a488e08b299cbe60ebe713d18.tar.gz firejail-b80014ad573b096a488e08b299cbe60ebe713d18.tar.zst firejail-b80014ad573b096a488e08b299cbe60ebe713d18.zip |
improve copy_file
don't report success if read failed
-rw-r--r-- | src/firejail/util.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/firejail/util.c b/src/firejail/util.c index 9f878611a..02befdc12 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #include <fcntl.h> | 34 | #include <fcntl.h> |
35 | #ifndef O_PATH | 35 | #ifndef O_PATH |
36 | # define O_PATH 010000000 | 36 | #define O_PATH 010000000 |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define MAX_GROUPS 1024 | 39 | #define MAX_GROUPS 1024 |
@@ -281,8 +281,9 @@ static int copy_file_by_fd(int src, int dst) { | |||
281 | done += rv; | 281 | done += rv; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | // fflush(0); | 284 | if (len == 0) |
285 | return 0; | 285 | return 0; |
286 | return -1; | ||
286 | } | 287 | } |
287 | 288 | ||
288 | // return -1 if error, 0 if no error; if destname already exists, return error | 289 | // return -1 if error, 0 if no error; if destname already exists, return error |