X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fremount-fs%2Fremount-fs.c;h=cd7cfe7a474a3aa73405cb2179bbd0b2b2eea593;hb=cc821d02a37c8c76aaf15bae2d33fee1bdc4b2e0;hp=b49d095cbb402ea0fbb25909663db45058a8e09c;hpb=f274ece0f76b5709408821e317e87aef76123db6;p=elogind.git diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c index b49d095cb..cd7cfe7a4 100644 --- a/src/remount-fs/remount-fs.c +++ b/src/remount-fs/remount-fs.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { int ret = EXIT_FAILURE; - FILE *f = NULL; + _cleanup_endmntent_ FILE *f = NULL; struct mntent* me; Hashmap *pids = NULL; @@ -57,16 +57,14 @@ int main(int argc, char *argv[]) { f = setmntent("/etc/fstab", "r"); if (!f) { - if (errno == ENOENT) { - ret = EXIT_SUCCESS; - goto finish; - } + if (errno == ENOENT) + return EXIT_SUCCESS; log_error("Failed to open /etc/fstab: %m"); - goto finish; + return EXIT_FAILURE; } - pids = hashmap_new(trivial_hash_func, trivial_compare_func); + pids = hashmap_new(NULL); if (!pids) { log_error("Failed to allocate set"); goto finish; @@ -129,10 +127,9 @@ int main(int argc, char *argv[]) { } while (!hashmap_isempty(pids)) { - siginfo_t si; + siginfo_t si = {}; char *s; - zero(si); if (waitid(P_ALL, 0, &si, WEXITED) < 0) { if (errno == EINTR) @@ -163,8 +160,5 @@ finish: if (pids) hashmap_free_free(pids); - if (f) - endmntent(f); - return ret; }