diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-03-23 14:04:59 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-03-23 16:37:05 +0100 |
commit | 86b86107942e84de4eb22944251694c0ae21b3ee (patch) | |
tree | 178f9611be0f6e76668d751e79263da226f1e764 | |
parent | 49bd547b38330989b435a1f641aab87fa9bda3a2 (diff) | |
download | systemd-86b86107942e84de4eb22944251694c0ae21b3ee.tar.gz |
blockdev-util: actually specify an access mode on open()
Linux is pretty lenient here, but we should specify the access mode.
-rw-r--r-- | src/basic/blockdev-util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/blockdev-util.c b/src/basic/blockdev-util.c index 2f3f1aecc8..676ad9351b 100644 --- a/src/basic/blockdev-util.c +++ b/src/basic/blockdev-util.c @@ -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; |