diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-12-23 10:33:25 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-12-23 10:35:34 +0000 |
commit | 690ff694ca6db586c06ec484ea158261c156aa2f (patch) | |
tree | 0b2de2288deb1b6af1b51519da6cf8293ff9cfde /src/filearch.c | |
parent | 486cafd4acf4945bbf3fea541eaa320f5c419406 (diff) | |
download | libguestfs-690ff694ca6db586c06ec484ea158261c156aa2f.tar.gz libguestfs-690ff694ca6db586c06ec484ea158261c156aa2f.tar.xz libguestfs-690ff694ca6db586c06ec484ea158261c156aa2f.zip |
lib: Add guestfs___remove_tmpdir helper function.
This function does 'rm -rf <dir>' for temporary directories, safely
working if '<dir>' contains shell meta-characters.
Replace existing code for removing directories with this.
Diffstat (limited to 'src/filearch.c')
-rw-r--r-- | src/filearch.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/filearch.c b/src/filearch.c index 0ed64257..1802ec47 100644 --- a/src/filearch.c +++ b/src/filearch.c @@ -213,12 +213,7 @@ cpio_arch (guestfs_h *g, const char *file, const char *path) error (g, "file_architecture: could not determine architecture of cpio archive"); out: - /* Free up the temporary directory. Note the directory name cannot - * contain shell meta-characters because of the way it was - * constructed above. - */ - snprintf (cmd, cmd_len, "rm -rf %s", dir); - ignore_value (system (cmd)); + guestfs___remove_tmpdir (dir); return ret; #undef dir_len |