aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/paths.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2019-10-31 10:59:19 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2019-10-31 10:59:19 -0400
commiteb86b55034032cfed418597263ff9e1ccfd6aec6 (patch)
tree7169fabe55df48d00770bcafd76462022868c57a /src/firejail/paths.c
parentAdd libdrm to wusc (diff)
downloadfirejail-eb86b55034032cfed418597263ff9e1ccfd6aec6.tar.gz
firejail-eb86b55034032cfed418597263ff9e1ccfd6aec6.tar.zst
firejail-eb86b55034032cfed418597263ff9e1ccfd6aec6.zip
remove scan-build warning
Diffstat (limited to 'src/firejail/paths.c')
-rw-r--r--src/firejail/paths.c6
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;
24static unsigned int path_cnt = 0; 24static unsigned int path_cnt = 0;
25static unsigned int longest_path_elt = 0; 25static unsigned int longest_path_elt = 0;
26 26
27static char *elt = NULL; // moved from inside init_paths in order to get rid of scan-build warning
27static void init_paths(void) { 28static 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}