summaryrefslogtreecommitdiffstats
path: root/daemon/mount.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-08-12 09:49:24 +0200
committerJim Meyering <meyering@redhat.com>2009-08-13 14:45:34 +0200
commita0bb8e69de762aa88144c7a4825e13c446c2bbcb (patch)
tree7419f03b8b281bc9e58e4f17cae003beca09a3d0 /daemon/mount.c
parent3a5a66de8f847a0ff11fdcf6c1644e19aa54c0f7 (diff)
downloadlibguestfs-a0bb8e69de762aa88144c7a4825e13c446c2bbcb.tar.gz
libguestfs-a0bb8e69de762aa88144c7a4825e13c446c2bbcb.tar.xz
libguestfs-a0bb8e69de762aa88144c7a4825e13c446c2bbcb.zip
do_umount: don't use RESOLVE_DEVICE anymore
* daemon/mount.c (do_umount): Don't use RESOLVE_DEVICE here, now that the caller always invokes REQUIRE_ROOT_OR_RESOLVE_DEVICE.
Diffstat (limited to 'daemon/mount.c')
-rw-r--r--daemon/mount.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/daemon/mount.c b/daemon/mount.c
index 89bef346..4f74c028 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -105,24 +105,20 @@ do_mount_options (const char *options, const char *device,
int
do_umount (const char *pathordevice)
{
- int freeit = 0, r;
- char *buf;
+ int r;
char *err;
- if (strncmp (pathordevice, "/dev/", 5) == 0) {
- buf = pathordevice;
- RESOLVE_DEVICE (buf, return -1);
- } else {
- buf = sysroot_path (pathordevice);
- if (buf == NULL) {
- reply_with_perror ("malloc");
- return -1;
- }
- freeit = 1;
+ char *buf = (strncmp (pathordevice, "/dev/", 5) == 0
+ ? strdup (pathordevice)
+ : sysroot_path (pathordevice));
+ if (buf == NULL) {
+ reply_with_perror ("malloc");
+ return -1;
}
r = command (NULL, &err, "umount", buf, NULL);
- if (freeit) free (buf);
+ free (buf);
+
if (r == -1) {
reply_with_error ("umount: %s: %s", pathordevice, err);
free (err);