diff options
Diffstat (limited to 'src/firejail/util.c')
-rw-r--r-- | src/firejail/util.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/firejail/util.c b/src/firejail/util.c index 71dd84e8f..3e6c56f73 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | #define _XOPEN_SOURCE 500 | 20 | #define _XOPEN_SOURCE 500 |
21 | #include "firejail.h" | 21 | #include "firejail.h" |
22 | #include "../include/gcov_wrapper.h" | ||
22 | #include <ftw.h> | 23 | #include <ftw.h> |
23 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
24 | #include <sys/mount.h> | 25 | #include <sys/mount.h> |
@@ -41,10 +42,6 @@ | |||
41 | #include <linux/openat2.h> | 42 | #include <linux/openat2.h> |
42 | #endif | 43 | #endif |
43 | 44 | ||
44 | #ifdef HAVE_GCOV | ||
45 | #include "../include/gcov_wrapper.h" | ||
46 | #endif | ||
47 | |||
48 | #define MAX_GROUPS 1024 | 45 | #define MAX_GROUPS 1024 |
49 | #define MAXBUF 4098 | 46 | #define MAXBUF 4098 |
50 | #define EMPTY_STRING ("") | 47 | #define EMPTY_STRING ("") |
@@ -341,9 +338,9 @@ void copy_file_as_user(const char *srcname, const char *destname, uid_t uid, gid | |||
341 | int rv = copy_file(srcname, destname, uid, gid, mode); // already a regular user | 338 | int rv = copy_file(srcname, destname, uid, gid, mode); // already a regular user |
342 | if (rv) | 339 | if (rv) |
343 | fwarning("cannot copy %s\n", srcname); | 340 | fwarning("cannot copy %s\n", srcname); |
344 | #ifdef HAVE_GCOV | 341 | |
345 | __gcov_flush(); | 342 | __gcov_flush(); |
346 | #endif | 343 | |
347 | _exit(0); | 344 | _exit(0); |
348 | } | 345 | } |
349 | // wait for the child to finish | 346 | // wait for the child to finish |
@@ -375,9 +372,9 @@ void copy_file_from_user_to_root(const char *srcname, const char *destname, uid_ | |||
375 | close(src); | 372 | close(src); |
376 | } | 373 | } |
377 | close(dst); | 374 | close(dst); |
378 | #ifdef HAVE_GCOV | 375 | |
379 | __gcov_flush(); | 376 | __gcov_flush(); |
380 | #endif | 377 | |
381 | _exit(0); | 378 | _exit(0); |
382 | } | 379 | } |
383 | // wait for the child to finish | 380 | // wait for the child to finish |
@@ -406,9 +403,9 @@ void touch_file_as_user(const char *fname, mode_t mode) { | |||
406 | } | 403 | } |
407 | else | 404 | else |
408 | fwarning("cannot create %s\n", fname); | 405 | fwarning("cannot create %s\n", fname); |
409 | #ifdef HAVE_GCOV | 406 | |
410 | __gcov_flush(); | 407 | __gcov_flush(); |
411 | #endif | 408 | |
412 | _exit(0); | 409 | _exit(0); |
413 | } | 410 | } |
414 | // wait for the child to finish | 411 | // wait for the child to finish |
@@ -1015,9 +1012,9 @@ int remove_overlay_directory(void) { | |||
1015 | // remove ~/.firejail | 1012 | // remove ~/.firejail |
1016 | if (rmdir(path) == -1) | 1013 | if (rmdir(path) == -1) |
1017 | errExit("rmdir"); | 1014 | errExit("rmdir"); |
1018 | #ifdef HAVE_GCOV | 1015 | |
1019 | __gcov_flush(); | 1016 | __gcov_flush(); |
1020 | #endif | 1017 | |
1021 | _exit(0); | 1018 | _exit(0); |
1022 | } | 1019 | } |
1023 | // wait for the child to finish | 1020 | // wait for the child to finish |
@@ -1073,9 +1070,9 @@ int create_empty_dir_as_user(const char *dir, mode_t mode) { | |||
1073 | } | 1070 | } |
1074 | else if (arg_debug) | 1071 | else if (arg_debug) |
1075 | printf("Directory %s not created: %s\n", dir, strerror(errno)); | 1072 | printf("Directory %s not created: %s\n", dir, strerror(errno)); |
1076 | #ifdef HAVE_GCOV | 1073 | |
1077 | __gcov_flush(); | 1074 | __gcov_flush(); |
1078 | #endif | 1075 | |
1079 | _exit(0); | 1076 | _exit(0); |
1080 | } | 1077 | } |
1081 | waitpid(child, NULL, 0); | 1078 | waitpid(child, NULL, 0); |