aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 00953d5..0faccbc 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1618,3 +1618,21 @@ cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir)
return 0;
}
+void
+change_dir ()
+{
+ if (change_directory_option && chdir (change_directory_option))
+ {
+ if (errno == ENOENT && create_dir_flag)
+ {
+ if (make_path (change_directory_option, -1, -1,
+ (warn_option & CPIO_WARN_INTERDIR) ?
+ _("Creating directory `%s'") : NULL))
+ exit (PAXEXIT_FAILURE);
+ if (chdir (change_directory_option) == 0)
+ return;
+ }
+ error (PAXEXIT_FAILURE, errno,
+ _("cannot change to directory `%s'"), change_directory_option);
+ }
+}

Return to:

Send suggestions and report system problems to the System administrator.