diff options
Diffstat (limited to 'src/firejail/fs_logger.c')
-rw-r--r-- | src/firejail/fs_logger.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/firejail/fs_logger.c b/src/firejail/fs_logger.c index 058bcc1c9..227a66cd7 100644 --- a/src/firejail/fs_logger.c +++ b/src/firejail/fs_logger.c | |||
@@ -157,27 +157,27 @@ void fs_logger_print_log(pid_t pid) { | |||
157 | if (uid != 0) { | 157 | if (uid != 0) { |
158 | uid_t sandbox_uid = pid_get_uid(pid); | 158 | uid_t sandbox_uid = pid_get_uid(pid); |
159 | if (uid != sandbox_uid) { | 159 | if (uid != sandbox_uid) { |
160 | fprintf(stderr, "Error: permission denied.\n"); | 160 | fprintf(stderr, "Error: permission denied\n"); |
161 | exit(1); | 161 | exit(1); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | // print RUN_FSLOGGER_FILE | 165 | // print RUN_FSLOGGER_FILE |
166 | EUID_ROOT(); | ||
167 | char *fname; | 166 | char *fname; |
168 | if (asprintf(&fname, "/proc/%d/root%s", pid, RUN_FSLOGGER_FILE) == -1) | 167 | if (asprintf(&fname, "/proc/%d/root%s", pid, RUN_FSLOGGER_FILE) == -1) |
169 | errExit("asprintf"); | 168 | errExit("asprintf"); |
170 | 169 | ||
170 | EUID_ROOT(); | ||
171 | struct stat s; | 171 | struct stat s; |
172 | if (stat(fname, &s) == -1) { | 172 | if (stat(fname, &s) == -1) { |
173 | printf("Cannot access filesystem log.\n"); | 173 | fprintf(stderr, "Error: Cannot access filesystem log\n"); |
174 | exit(1); | 174 | exit(1); |
175 | } | 175 | } |
176 | 176 | ||
177 | /* coverity[toctou] */ | 177 | /* coverity[toctou] */ |
178 | FILE *fp = fopen(fname, "r"); | 178 | FILE *fp = fopen(fname, "r"); |
179 | if (!fp) { | 179 | if (!fp) { |
180 | printf("Cannot open filesystem log.\n"); | 180 | fprintf(stderr, "Error: Cannot open filesystem log\n"); |
181 | exit(1); | 181 | exit(1); |
182 | } | 182 | } |
183 | 183 | ||