diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-21 11:10:34 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-21 11:47:13 +0100 |
commit | 488bb758c074314b08293ae1501f6b53352f7d87 (patch) | |
tree | a81d434eb659baa2280f9bf3ff75403937f5c79a /src/partition | |
parent | 48b1e18aaee487b7e3f5bf881c2848a7f4ce79b4 (diff) | |
download | systemd-488bb758c074314b08293ae1501f6b53352f7d87.tar.gz |
repart: Use fd based operations in partition_populate_directory()
Diffstat (limited to 'src/partition')
-rw-r--r-- | src/partition/repart.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c index 9a6bbdfb32..5bae554258 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -3782,6 +3782,7 @@ static int do_make_directories(Partition *p, const char *root) { static int partition_populate_directory(Partition *p, const Set *denylist, char **ret) { _cleanup_(rm_rf_physical_and_freep) char *root = NULL; + _cleanup_close_ int rfd = -1; int r; assert(ret); @@ -3791,11 +3792,11 @@ static int partition_populate_directory(Partition *p, const Set *denylist, char return 0; } - r = mkdtemp_malloc("/var/tmp/repart-XXXXXX", &root); - if (r < 0) - return log_error_errno(r, "Failed to create temporary directory: %m"); + rfd = mkdtemp_open("/var/tmp/repart-XXXXXX", 0, &root); + if (rfd < 0) + return log_error_errno(rfd, "Failed to create temporary directory: %m"); - if (chmod(root, 0755) < 0) + if (fchmod(rfd, 0755) < 0) return log_error_errno(errno, "Failed to change mode of temporary directory: %m"); /* Make sure everything is owned by the user running repart so that make_filesystem() can map the |