diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-10-03 22:13:55 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-10-03 22:13:55 -0400 |
commit | 5862d652ba14178cff46b8a8fc6c6d8392bf32b1 (patch) | |
tree | b5f526c49e7aa8f5115fd59faecac865bdefce22 /src/remount-fs | |
parent | 9a5cb1371b6d8b0a04bd08665bcf9b06cb40c64c (diff) | |
download | systemd-5862d652ba14178cff46b8a8fc6c6d8392bf32b1.tar.gz systemd-5862d652ba14178cff46b8a8fc6c6d8392bf32b1.tar.bz2 systemd-5862d652ba14178cff46b8a8fc6c6d8392bf32b1.zip |
Introduce _cleanup_endmntent_
Diffstat (limited to 'src/remount-fs')
-rw-r--r-- | src/remount-fs/remount-fs.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c index f432718d6b..847637a12c 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,13 +57,11 @@ 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); @@ -162,8 +160,5 @@ finish: if (pids) hashmap_free_free(pids); - if (f) - endmntent(f); - return ret; } |