diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-03-31 02:35:00 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-03-31 06:48:03 -0700 |
commit | 8e06af804b125a035156bac24008a7112e9ce448 (patch) | |
tree | 8e521812146584b633daed7c78f210cc7a1ed15f /src/home/homework-cifs.c | |
parent | b46c3e4913f7f234039ebd8104446450917cab8d (diff) | |
download | systemd-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.c | 9 |
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(©); + if (!d) return -errno; - } errno = 0; if (readdir_no_dot(d)) |