diff options
Diffstat (limited to 'src/launch.c')
-rw-r--r-- | src/launch.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/launch.c b/src/launch.c index 46817073..d2c1a42a 100644 --- a/src/launch.c +++ b/src/launch.c @@ -701,81 +701,6 @@ guestfs___launch_failed_error (guestfs_h *g) "and/or run 'libguestfs-test-tool'.")); } -/* Return the location of the tmpdir (eg. "/tmp") and allow users - * to override it at runtime using $TMPDIR. - * http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES - */ -const char * -guestfs_tmpdir (void) -{ - const char *tmpdir; - -#ifdef P_tmpdir - tmpdir = P_tmpdir; -#else - tmpdir = "/tmp"; -#endif - - const char *t = getenv ("TMPDIR"); - if (t) tmpdir = t; - - return tmpdir; -} - -/* Return the location of the persistent tmpdir (eg. "/var/tmp") and - * allow users to override it at runtime using $TMPDIR. - * http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE - */ -const char * -guestfs___persistent_tmpdir (void) -{ - const char *tmpdir; - - tmpdir = "/var/tmp"; - - const char *t = getenv ("TMPDIR"); - if (t) tmpdir = t; - - return tmpdir; -} - -/* The g->tmpdir (per-handle temporary directory) is not created when - * the handle is created. Instead we create it lazily before the - * first time it is used, or during launch. - */ -int -guestfs___lazy_make_tmpdir (guestfs_h *g) -{ - if (!g->tmpdir) { - TMP_TEMPLATE_ON_STACK (dir_template); - g->tmpdir = safe_strdup (g, dir_template); - if (mkdtemp (g->tmpdir) == NULL) { - perrorf (g, _("%s: cannot create temporary directory"), dir_template); - return -1; - } - } - return 0; -} - -/* 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. - */ -void -guestfs___remove_tmpdir (guestfs_h *g, const char *dir) -{ - struct command *cmd; - - cmd = guestfs___new_command (g); - guestfs___cmd_add_arg (cmd, "rm"); - guestfs___cmd_add_arg (cmd, "-rf"); - guestfs___cmd_add_arg (cmd, dir); - /* Ignore failures. */ - guestfs___cmd_run (cmd); - guestfs___cmd_close (cmd); -} - int guestfs__get_pid (guestfs_h *g) { |