mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user