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

[Libguestfs] do_umount adjustment



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;
}


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