summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-03-23 14:04:59 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-03-24 11:26:20 +0100
commit6555b0557624c184f4f8b34617411a02d6365d5a (patch)
treea69dac3ffd01a21085ab279e533247280012db7d
parent423b1e759c73fe0bb8257a9e8da27c73e6637220 (diff)
downloadsystemd-6555b0557624c184f4f8b34617411a02d6365d5a.tar.gz
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) (cherry picked from commit 857533a523d058e9833a553f6ef192ff1ab33b15)
-rw-r--r--src/basic/blockdev-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/blockdev-util.c b/src/basic/blockdev-util.c
index 4e68e2496b..abf9bf02d8 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;