[Libguestfs] do_umount adjustment

Jim Meyering jim at meyering.net
Wed Aug 12 08:14:51 UTC 2009


Here's one final (I hope) question without a complete patch.
Given that I already ensure that stubs.c invokes
REQUIRE_ROOT_OR_RESOLVE_DEVICE just before calling do_umount,
does this new version of do_umount look ok?

/* 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 = sysroot_path (pathordevice);
  if (buf == NULL) {
    reply_with_perror ("malloc");
    return -1;
  }

  r = command (NULL, &err, "umount", buf, NULL);
  if (r == -1) {
    reply_with_error ("umount: %s: %s", pathordevice, err);
    free (err);
    free (buf);
    return -1;
  }

  free (err);

  /* update root_mounted? */

  return 0;
}




More information about the Libguestfs mailing list