diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/paths.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/firejail/paths.c b/src/firejail/paths.c index 6317d4db8..960412acf 100644 --- a/src/firejail/paths.c +++ b/src/firejail/paths.c | |||
@@ -24,6 +24,7 @@ static char **paths = 0; | |||
24 | static unsigned int path_cnt = 0; | 24 | static unsigned int path_cnt = 0; |
25 | static unsigned int longest_path_elt = 0; | 25 | static unsigned int longest_path_elt = 0; |
26 | 26 | ||
27 | static char *elt = NULL; // moved from inside init_paths in order to get rid of scan-build warning | ||
27 | static void init_paths(void) { | 28 | static void init_paths(void) { |
28 | char *path = getenv("PATH"); | 29 | char *path = getenv("PATH"); |
29 | char *p; | 30 | char *p; |
@@ -46,10 +47,9 @@ static void init_paths(void) { | |||
46 | errExit("calloc"); | 47 | errExit("calloc"); |
47 | 48 | ||
48 | // fill in 'paths' with pointers to elements of 'path' | 49 | // fill in 'paths' with pointers to elements of 'path' |
49 | char *elt; | ||
50 | unsigned int i = 0, j; | 50 | unsigned int i = 0, j; |
51 | unsigned int len; | 51 | unsigned int len; |
52 | while ((elt = strsep(&path, ":")) != 0) { | 52 | while ((elt = strsep(&path, ":")) != NULL) { |
53 | // skip any entry that is not absolute | 53 | // skip any entry that is not absolute |
54 | if (elt[0] != '/') | 54 | if (elt[0] != '/') |
55 | goto skip; | 55 | goto skip; |
@@ -73,7 +73,7 @@ static void init_paths(void) { | |||
73 | skip:; | 73 | skip:; |
74 | } | 74 | } |
75 | 75 | ||
76 | assert(paths[i] == 0); | 76 | assert(paths[i] == NULL); |
77 | // path_cnt may be too big now, if entries were skipped above | 77 | // path_cnt may be too big now, if entries were skipped above |
78 | path_cnt = i+1; | 78 | path_cnt = i+1; |
79 | } | 79 | } |