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>
This commit is contained in:
Stanislav Brabec 2017-04-11 16:12:52 +02:00 committed by Karel Zak
parent 1ab3f16b43
commit ecfeae90a2
1 changed files with 5 additions and 0 deletions

View File

@ -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;