diff options
Diffstat (limited to 'src/faudit/pid.c')
-rw-r--r-- | src/faudit/pid.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/faudit/pid.c b/src/faudit/pid.c index 34f6d1691..0aa2ddd44 100644 --- a/src/faudit/pid.c +++ b/src/faudit/pid.c | |||
@@ -32,7 +32,7 @@ void pid_test(void) { | |||
32 | 32 | ||
33 | // look at the first 10 processes | 33 | // look at the first 10 processes |
34 | int not_visible = 1; | 34 | int not_visible = 1; |
35 | for (i = 1; i <= 10; i++) { | 35 | for (i = 1; i <= 10; i++) { |
36 | struct stat s; | 36 | struct stat s; |
37 | char *fname; | 37 | char *fname; |
38 | if (asprintf(&fname, "/proc/%d/comm", i) == -1) | 38 | if (asprintf(&fname, "/proc/%d/comm", i) == -1) |
@@ -41,7 +41,7 @@ void pid_test(void) { | |||
41 | free(fname); | 41 | free(fname); |
42 | continue; | 42 | continue; |
43 | } | 43 | } |
44 | 44 | ||
45 | // open file | 45 | // open file |
46 | /* coverity[toctou] */ | 46 | /* coverity[toctou] */ |
47 | FILE *fp = fopen(fname, "r"); | 47 | FILE *fp = fopen(fname, "r"); |
@@ -49,7 +49,7 @@ void pid_test(void) { | |||
49 | free(fname); | 49 | free(fname); |
50 | continue; | 50 | continue; |
51 | } | 51 | } |
52 | 52 | ||
53 | // read file | 53 | // read file |
54 | char buf[100]; | 54 | char buf[100]; |
55 | if (fgets(buf, 10, fp) == NULL) { | 55 | if (fgets(buf, 10, fp) == NULL) { |
@@ -63,7 +63,7 @@ void pid_test(void) { | |||
63 | char *ptr; | 63 | char *ptr; |
64 | if ((ptr = strchr(buf, '\n')) != NULL) | 64 | if ((ptr = strchr(buf, '\n')) != NULL) |
65 | *ptr = '\0'; | 65 | *ptr = '\0'; |
66 | 66 | ||
67 | // check process name against the kernel list | 67 | // check process name against the kernel list |
68 | int j = 0; | 68 | int j = 0; |
69 | while (kern_proc[j] != NULL) { | 69 | while (kern_proc[j] != NULL) { |
@@ -76,7 +76,7 @@ void pid_test(void) { | |||
76 | } | 76 | } |
77 | j++; | 77 | j++; |
78 | } | 78 | } |
79 | 79 | ||
80 | fclose(fp); | 80 | fclose(fp); |
81 | free(fname); | 81 | free(fname); |
82 | } | 82 | } |
@@ -86,7 +86,7 @@ void pid_test(void) { | |||
86 | printf("BAD: Process %d is not running in a PID namespace.\n", pid); | 86 | printf("BAD: Process %d is not running in a PID namespace.\n", pid); |
87 | else | 87 | else |
88 | printf("GOOD: process %d is running in a PID namespace.\n", pid); | 88 | printf("GOOD: process %d is running in a PID namespace.\n", pid); |
89 | 89 | ||
90 | // try to guess the type of container/sandbox | 90 | // try to guess the type of container/sandbox |
91 | char *str = getenv("container"); | 91 | char *str = getenv("container"); |
92 | if (str) | 92 | if (str) |