summaryrefslogtreecommitdiff
path: root/src/home/homework-cifs.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-03-31 02:35:00 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-03-31 06:48:03 -0700
commit8e06af804b125a035156bac24008a7112e9ce448 (patch)
tree8e521812146584b633daed7c78f210cc7a1ed15f /src/home/homework-cifs.c
parentb46c3e4913f7f234039ebd8104446450917cab8d (diff)
downloadsystemd-8e06af804b125a035156bac24008a7112e9ce448.tar.gz
*: use _cleanup_close_ with fdopendir() where trivial
Also convert these to use take_fdopendir().
Diffstat (limited to 'src/home/homework-cifs.c')
-rw-r--r--src/home/homework-cifs.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/home/homework-cifs.c b/src/home/homework-cifs.c
index 27f298144a..1510031a38 100644
--- a/src/home/homework-cifs.c
+++ b/src/home/homework-cifs.c
@@ -142,7 +142,8 @@ int home_create_cifs(UserRecord *h, UserRecord **ret_home) {
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
_cleanup_(closedirp) DIR *d = NULL;
- int r, copy;
+ _cleanup_close_ int copy = -1;
+ int r;
assert(h);
assert(user_record_storage(h) == USER_CIFS);
@@ -166,11 +167,9 @@ int home_create_cifs(UserRecord *h, UserRecord **ret_home) {
if (copy < 0)
return -errno;
- d = fdopendir(copy);
- if (!d) {
- safe_close(copy);
+ d = take_fdopendir(&copy);
+ if (!d)
return -errno;
- }
errno = 0;
if (readdir_no_dot(d))