1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-02 09:47:03 +03:00

blockdev-util: actually specify an access mode on open()

Linux is pretty lenient here, but we should specify the access mode.

(cherry picked from commit 86b86107942e84de4eb22944251694c0ae21b3ee)
This commit is contained in:
Lennart Poettering 2021-03-23 14:04:59 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 7e88a9aef6
commit 857533a523

View File

@ -68,7 +68,7 @@ int get_block_device(const char *path, dev_t *ret) {
/* Gets the block device directly backing a file system. If the block device is encrypted, returns
* the device mapper block device. */
fd = open(path, O_NOFOLLOW|O_CLOEXEC);
fd = open(path, O_RDONLY|O_NOFOLLOW|O_CLOEXEC);
if (fd < 0)
return -errno;