Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
readability/making it more obvious buffers
are properly initialized
  • Loading branch information
smitsohu committed Feb 12, 2021
1 parent 1059464 commit f25b12c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/firejail/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,13 @@ void fs_tmpfs(const char *dir, unsigned check_owner) {

// remount path, preserving other mount flags; requires a resolved path
static void fs_remount_simple(const char *path, OPERATION op) {
struct stat s1, s2;
assert(path);

// open path without following symbolic links
int fd1 = safe_fd(path, O_PATH|O_|O_CLOEXEC);
if (fd1 == -1)
goto out;
struct stat s1;
if (fstat(fd1, &s1) == -1) {
// fstat can fail with EACCES if path is a FUSE mount,
// mounted without 'allow_root' or 'allow_other'
Expand Down Expand Up @@ -561,6 +561,7 @@ static void fs_remount_simple(const char *path, OPERATION op) {
int fd2 = safe_fd(path, O_PATH|O_|O_CLOEXEC);
if (fd2 == -1)
errExit("open");
struct stat s2;
if (fstat(fd2, &s2) == -1)
errExit("fstat");
// device and inode number should be the same
Expand Down

0 comments on commit f25b12c

Please sign in to comment.