Skip to content

Commit

Permalink
minor cleanup, cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
smitsohu committed Dec 21, 2020
1 parent 039e77e commit 10d75c3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/firejail/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
#include <sys/ioctl.h>
#include <termios.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <limits.h>

#include <fcntl.h>
#ifndef O_PATH
#define O_PATH 010000000
#endif

#include <sys/syscall.h>
#ifdef __NR_openat2
#include <linux/openat2.h>
#endif
Expand Down Expand Up @@ -1013,12 +1013,8 @@ int create_empty_dir_as_user(const char *dir, mode_t mode) {
if (chmod(dir, mode) == -1)
{;} // do nothing
}
else if (arg_debug) {
char *str;
if (asprintf(&str, "Directory %s not created", dir) == -1)
errExit("asprintf");
perror(str);
}
else if (arg_debug)
printf("Directory %s not created: %s\n", dir, strerror(errno));
#ifdef HAVE_GCOV
__gcov_flush();
#endif
Expand Down Expand Up @@ -1165,12 +1161,12 @@ void disable_file_path(const char *path, const char *file) {

// open an existing file without following any symbolic link
int safe_fd(const char *path, int flags) {
flags |= O_;
assert(path);
if (*path != '/' || strstr(path, "..")) {
fprintf(stderr, "Error: invalid path %s\n", path);
exit(1);
}
flags |= O_;
int fd = -1;

#ifdef __NR_openat2 // kernel 5.6 or better
Expand Down

0 comments on commit 10d75c3

Please sign in to comment.