[hackers] [ubase] mount: mounted(): dont exit on non-fatal things || Hiltjo Posthuma
commit 9031fcfd29ee05c6e3d66eaa0b888a0375bf8cf6
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat Mar 22 12:29:41 2014 +0100
mount: mounted(): dont exit on non-fatal things
this fixes mount -a. proceed iterating fstab entries even if an error occurs with some entry.
Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
diff --git a/mount.c b/mount.c
index df82109..6afa438 100644
--- a/mount.c
+++ b/mount.c
_AT_@ -73,17 +73,21 @@ mounted(const char *dir)
struct mntent *me;
struct stat st1, st2;
- if (stat(dir, &st1) < 0)
- eprintf("stat %s:", dir);
+ if (stat(dir, &st1) < 0) {
+ weprintf("stat %s:", dir);
+ return 0;
+ }
fp = setmntent("/proc/mounts", "r");
if (!fp)
eprintf("setmntent %s:", "/proc/mounts");
while ((me = getmntent(fp)) != NULL) {
- if (stat(me->mnt_dir, &st2) < 0)
- eprintf("stat %s:", me->mnt_dir);
+ if (stat(me->mnt_dir, &st2) < 0) {
+ weprintf("stat %s:", me->mnt_dir);
+ continue;
+ }
if (st1.st_dev == st2.st_dev &&
st1.st_ino == st2.st_ino)
- return 1;
+ return 1;
}
endmntent(fp);
return 0;
Received on Sat Mar 22 2014 - 23:18:57 CET
This archive was generated by hypermail 2.3.0
: Sat Mar 22 2014 - 23:24:15 CET