diff options
-rw-r--r-- | archival/cpio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index 94303389e..d84f6937d 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
@@ -418,7 +418,8 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) | |||
418 | if (argv[0] == NULL) | 418 | if (argv[0] == NULL) |
419 | bb_show_usage(); | 419 | bb_show_usage(); |
420 | if (opt & OPT_CREATE_LEADING_DIR) | 420 | if (opt & OPT_CREATE_LEADING_DIR) |
421 | mkdir(argv[0], 0777); | 421 | /* GNU cpio 2.13: "cpio -d -p a/b/c" works */ |
422 | bb_make_directory(argv[0], -1, FILEUTILS_RECUR); | ||
422 | /* Crude existence check: | 423 | /* Crude existence check: |
423 | * close(xopen(argv[0], O_RDONLY | O_DIRECTORY)); | 424 | * close(xopen(argv[0], O_RDONLY | O_DIRECTORY)); |
424 | * We can also xopen, fstat, IS_DIR, later fchdir. | 425 | * We can also xopen, fstat, IS_DIR, later fchdir. |
@@ -428,6 +429,11 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) | |||
428 | * a diffrerent problem earlier. | 429 | * a diffrerent problem earlier. |
429 | * This is good enough for now. | 430 | * This is good enough for now. |
430 | */ | 431 | */ |
432 | //FIXME: GNU cpio -d -p DIR does not immediately create DIR - | ||
433 | //it just prepends "DIR/" to the names of files to be created. | ||
434 | //The first file (fails to) be copied, and then the -d logic | ||
435 | //triggers and creates all necessary directories. | ||
436 | //IOW: bare "cpio -d -p DIR" + ^C shouldn't create anything. | ||
431 | #if !BB_MMU | 437 | #if !BB_MMU |
432 | pp.rd = 3; | 438 | pp.rd = 3; |
433 | pp.wr = 4; | 439 | pp.wr = 4; |