+/* Recursively remove a temporary directory. If removal fails, just
+ * return (it's a temporary directory so it'll eventually be cleaned
+ * up by a temp cleaner). This is done using "rm -rf" because that's
+ * simpler and safer, but we have to exec to ensure that paths don't
+ * need to be quoted.
+ */
+void
+guestfs___remove_tmpdir (const char *dir)
+{
+ pid_t pid = fork ();
+
+ if (pid == -1) {
+ perror ("remove tmpdir: fork");
+ return;
+ }
+ if (pid == 0) {
+ execlp ("rm", "rm", "-rf", dir, NULL);
+ perror ("remove tmpdir: exec: rm");
+ _exit (EXIT_FAILURE);
+ }
+
+ /* Parent. */
+ if (waitpid (pid, NULL, 0) == -1) {
+ perror ("remove tmpdir: waitpid");
+ return;
+ }
+}
+