summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2010-11-10 01:25:07 +0100
committerKarel Zak2011-01-03 12:28:46 +0100
commit97e23b5e5eae8a8d5e14b263bb150e62073d453f (patch)
treee07e3f70491583060ea1484f5494c7a03d96f94c /shlibs/mount/src/context_umount.c
parenttests: add utab update tests (diff)
downloadkernel-qcow2-util-linux-97e23b5e5eae8a8d5e14b263bb150e62073d453f.tar.gz
kernel-qcow2-util-linux-97e23b5e5eae8a8d5e14b263bb150e62073d453f.tar.xz
kernel-qcow2-util-linux-97e23b5e5eae8a8d5e14b263bb150e62073d453f.zip
libmount: support /{proc,etc}/filesystems
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/context_umount.c')
-rw-r--r--shlibs/mount/src/context_umount.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c
index 476ee515c..87a0bc8ef 100644
--- a/shlibs/mount/src/context_umount.c
+++ b/shlibs/mount/src/context_umount.c
@@ -275,6 +275,7 @@ static int exec_helper(mnt_context *cxt)
assert(cxt->fs);
assert(cxt->helper);
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
+ assert(cxt->helper_exec_status == 1);
DBG_FLUSH;
@@ -329,12 +330,12 @@ static int exec_helper(mnt_context *cxt)
DBG(CXT, mnt_debug_h(cxt, "%s executed [status=%d]",
cxt->helper, cxt->helper_status));
- rc = 0;
+ cxt->helper_exec_status = rc = 0;
break;
}
case -1:
- rc = -errno;
+ cxt->helper_exec_status = rc = -errno;
DBG(CXT, mnt_debug_h(cxt, "fork() failed"));
break;
}
@@ -350,6 +351,7 @@ static int do_umount(mnt_context *cxt)
assert(cxt);
assert(cxt->fs);
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
+ assert(cxt->syscall_status == 1);
if (cxt->helper)
return exec_helper(cxt);
@@ -375,38 +377,37 @@ static int do_umount(mnt_context *cxt)
rc = umount(target);
if (rc < 0)
- cxt->syscall_errno = errno;
-
+ cxt->syscall_status = -errno;
/*
* try remount read-only
*/
- if (rc < 0 && cxt->syscall_errno == EBUSY &&
+ if (rc < 0 && cxt->syscall_status == -EBUSY &&
(cxt->flags & MNT_FL_RDONLY_UMOUNT) && src) {
cxt->mountflags |= MS_REMOUNT | MS_RDONLY;
cxt->flags &= ~MNT_FL_LOOPDEL;
DBG(CXT, mnt_debug_h(cxt, "umount(2) failed [errno=%d] -- "
"tring remount read-only",
- cxt->syscall_errno));
+ -cxt->syscall_status));
rc = mount(src, target, NULL,
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
if (rc < 0) {
- cxt->syscall_errno = errno;
+ cxt->syscall_status = -errno;
DBG(CXT, mnt_debug_h(cxt, "read-only re-mount(2) failed "
"[errno=%d]",
- cxt->syscall_errno));
- return -cxt->syscall_errno;
+ -cxt->syscall_status));
+ return cxt->syscall_status;
}
- cxt->syscall_errno = 0;
+ cxt->syscall_status = 0;
DBG(CXT, mnt_debug_h(cxt, "read-only re-mount(2) success"));
return 0;
}
if (rc < 0) {
DBG(CXT, mnt_debug_h(cxt, "umount(2) failed [errno=%d]",
- cxt->syscall_errno));
- return -cxt->syscall_errno;
+ -cxt->syscall_status));
+ return -cxt->syscall_status;
}
DBG(CXT, mnt_debug_h(cxt, "umount(2) success"));
return 0;