diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2010-03-01 03:49:53 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-07-22 12:54:07 +0300 |
commit | f40dd3ef902337afd9c5ccc6d69538e155ea26e7 (patch) | |
tree | 3b763a670b154aebc528d043a3996128a55af221 /src | |
parent | 211c804e8adbe223a96c3e8fb569ec6874cce838 (diff) | |
download | cpio-f40dd3ef902337afd9c5ccc6d69538e155ea26e7.tar.gz cpio-f40dd3ef902337afd9c5ccc6d69538e155ea26e7.tar.bz2 |
Fix --to-stdout option support
* src/copyin.c (copyin_link): Skip an appropriate number of bytes
when to_stdout_option flag is set.
* tests/symlink-to-stdout.at: New test case.
* tests/Makefile.am (TESTSUITE_AT): Add symlink-to-stdout.at.
* tests/testsuite.at: Include symlink-to-stdout.at.
Diffstat (limited to 'src')
-rw-r--r-- | src/copyin.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/copyin.c b/src/copyin.c index ac921e1..44b694d 100644 --- a/src/copyin.c +++ b/src/copyin.c @@ -645,11 +645,14 @@ copyin_link(struct cpio_file_stat *file_hdr, int in_file_des) char *link_name = NULL; /* Name of hard and symbolic links. */ int res; /* Result of various function calls. */ - if (to_stdout_option) - return; - if (archive_format != arf_tar && archive_format != arf_ustar) { + if (to_stdout_option) + { + tape_toss_input (in_file_des, file_hdr->c_filesize); + tape_skip_padding (in_file_des, file_hdr->c_filesize); + return; + } link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1); link_name[file_hdr->c_filesize] = '\0'; tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize); @@ -657,6 +660,8 @@ copyin_link(struct cpio_file_stat *file_hdr, int in_file_des) } else { + if (to_stdout_option) + return; link_name = xstrdup (file_hdr->c_tar_linkname); } |