On Wed, Aug 12, 2009 at 06:52:59PM +0200, Jim Meyering wrote:
From: Jim Meyering <meyering@redhat.com>
* daemon/mount.c (do_umount): Don't use RESOLVE_DEVICE here, now that the caller always invokes REQUIRE_ROOT_OR_RESOLVE_DEVICE. --- daemon/mount.c | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/daemon/mount.c b/daemon/mount.c index 9ccb37b..4f74c02 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; - const 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); -- 1.6.4.337.g5420e
As discussed before, ACK. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top