[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] do_umount adjustment



On Wed, Aug 12, 2009 at 10:49:15AM +0200, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> No need for ugliness after all.
> Here's a more faithful new version:
> 
> /* Again, use the external /bin/umount program, so that /etc/mtab
>  * is kept updated.
>  */
> int
> do_umount (const char *pathordevice)
> {
>   int r;
>   char *err;
> 
>   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);
>   free (buf);
> 
>   if (r == -1) {
>     reply_with_error ("umount: %s: %s", pathordevice, err);
>     free (err);
>     return -1;
>   }
> 
>   free (err);
> 
>   /* update root_mounted? */
> 
>   return 0;
> }

This looks good, so ACK.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]