diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fcopy/main.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/fcopy/main.c b/src/fcopy/main.c index 3f507a361..a08cc66b3 100644 --- a/src/fcopy/main.c +++ b/src/fcopy/main.c | |||
@@ -28,11 +28,10 @@ int arg_quiet = 0; | |||
28 | int arg_debug = 0; | 28 | int arg_debug = 0; |
29 | static int arg_follow_link = 0; | 29 | static int arg_follow_link = 0; |
30 | 30 | ||
31 | static int copy_limit = 500 * 1024 *1024; // 500 MB | 31 | static unsigned long long copy_limit = 500 * 1024 * 1024; // 500 MB |
32 | #define COPY_LIMIT ( | 32 | static unsigned long long size_cnt = 0; |
33 | static int size_limit_reached = 0; | 33 | static int size_limit_reached = 0; |
34 | static unsigned file_cnt = 0; | 34 | static unsigned file_cnt = 0; |
35 | static unsigned size_cnt = 0; | ||
36 | 35 | ||
37 | static char *outpath = NULL; | 36 | static char *outpath = NULL; |
38 | static char *inpath = NULL; | 37 | static char *inpath = NULL; |
@@ -187,7 +186,7 @@ static int fs_copydir(const char *infname, const struct stat *st, int ftype, str | |||
187 | 186 | ||
188 | // recalculate size | 187 | // recalculate size |
189 | if ((s.st_size + size_cnt) > copy_limit) { | 188 | if ((s.st_size + size_cnt) > copy_limit) { |
190 | fprintf(stderr, "Error fcopy: size limit of %dMB reached\n", (copy_limit / 1024) / 1024); | 189 | fprintf(stderr, "Error fcopy: size limit of %lluMB reached\n", (copy_limit / 1024) / 1024); |
191 | size_limit_reached = 1; | 190 | size_limit_reached = 1; |
192 | free(outfname); | 191 | free(outfname); |
193 | return 0; | 192 | return 0; |
@@ -392,9 +391,9 @@ int main(int argc, char **argv) { | |||
392 | // extract copy limit size from env variable, if any | 391 | // extract copy limit size from env variable, if any |
393 | char *cl = getenv("FIREJAIL_FILE_COPY_LIMIT"); | 392 | char *cl = getenv("FIREJAIL_FILE_COPY_LIMIT"); |
394 | if (cl) { | 393 | if (cl) { |
395 | copy_limit = atoi(cl) * 1024 * 1024; | 394 | copy_limit = strtoul(cl, NULL, 10) * 1024 * 1024; |
396 | if (arg_debug) | 395 | if (arg_debug) |
397 | printf("file copy limit %d bytes\n", copy_limit); | 396 | printf("file copy limit %llu bytes\n", copy_limit); |
398 | } | 397 | } |
399 | 398 | ||
400 | // copy files | 399 | // copy files |