diff options
author | Stanislav Brabec | 2017-04-11 16:12:52 +0200 |
---|---|---|
committer | Karel Zak | 2017-04-18 11:13:32 +0200 |
commit | ecfeae90a2947fb82e19076131a3ef166374b249 (patch) | |
tree | 666e22ba7b593151d7a836da30342ffb0b4b1cf5 /libmount | |
parent | bash-completion: update fincore (diff) | |
download | kernel-qcow2-util-linux-ecfeae90a2947fb82e19076131a3ef166374b249.tar.gz kernel-qcow2-util-linux-ecfeae90a2947fb82e19076131a3ef166374b249.tar.xz kernel-qcow2-util-linux-ecfeae90a2947fb82e19076131a3ef166374b249.zip |
libmount: Ensure utab.lock mode 644
If utab.lock is created by a process with a restricted umask, utab.lock is
created with restricted permissions. It breaks userspace monitor.
Ensure that the mode is always 644.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Diffstat (limited to 'libmount')
-rw-r--r-- | libmount/src/lock.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libmount/src/lock.c b/libmount/src/lock.c index 06eff1344..f9d0253fb 100644 --- a/libmount/src/lock.c +++ b/libmount/src/lock.c @@ -220,6 +220,11 @@ static int lock_simplelock(struct libmnt_lock *ml) rc = -errno; goto err; } + rc = fchmod(ml->lockfile_fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + if (rc < 0) { + rc = -errno; + goto err; + } while (flock(ml->lockfile_fd, LOCK_EX) < 0) { int errsv; |