summaryrefslogtreecommitdiff
path: root/src/partition/growfs.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-07-14 11:30:27 +0200
committerLennart Poettering <lennart@poettering.net>2022-07-14 11:30:27 +0200
commit2e7dd6682bc9da79d5249caa93ea1bde37a0f315 (patch)
tree9884f670896a492f652ba95b969e59a4c666439a /src/partition/growfs.c
parentf95db4d6facff297c169dca22becccb400f49f4a (diff)
downloadsystemd-2e7dd6682bc9da79d5249caa93ea1bde37a0f315.tar.gz
growfs: insist we open a directory when opening fs mount point
This is a simple safety check, since we shouldn't invoke ioctls on fds without being reasonably sure they are of the right type since ioctls are overloaded, and we might be tricked hence to execute an operation on an fd which means something different than what we expect.
Diffstat (limited to 'src/partition/growfs.c')
-rw-r--r--src/partition/growfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/partition/growfs.c b/src/partition/growfs.c
index 31dcf0ffdf..d7069b8d08 100644
--- a/src/partition/growfs.c
+++ b/src/partition/growfs.c
@@ -225,7 +225,7 @@ static int run(int argc, char *argv[]) {
if (r < 0)
return r;
- mountfd = open(arg_target, O_RDONLY|O_CLOEXEC);
+ mountfd = open(arg_target, O_RDONLY|O_CLOEXEC|O_DIRECTORY);
if (mountfd < 0)
return log_error_errno(errno, "Failed to open \"%s\": %m", arg_target);