diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-05-25 13:08:47 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-05-25 13:08:47 +0000 |
commit | 32c0c31a6bca088736a82a4e3be8baafa070aeb8 (patch) | |
tree | 4a72dba26c84a749cd20e8ee23ea5e1b85384ddc /src/copyout.c | |
parent | d9f146e2a1e8482388d17e0df207608f1031f3e1 (diff) | |
download | cpio-32c0c31a6bca088736a82a4e3be8baafa070aeb8.tar.gz cpio-32c0c31a6bca088736a82a4e3be8baafa070aeb8.tar.bz2 |
Use cpio_safer_name_suffix() and CPIO_TRAILER_NAME define instead of hardcoding the trailer file name.
Diffstat (limited to 'src/copyout.c')
-rw-r--r-- | src/copyout.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/copyout.c b/src/copyout.c index 5727d3c..7b64e91 100644 --- a/src/copyout.c +++ b/src/copyout.c @@ -449,7 +449,6 @@ process_copy_out () struct new_cpio_header file_hdr; /* Output header information. */ int in_file_des; /* Source file descriptor. */ int out_file_des; /* Output file descriptor. */ - char *p; /* Initialize the copy out. */ ds_init (&input_name, 128); @@ -515,19 +514,11 @@ process_copy_out () } } - p = safer_name_suffix (input_name.ds_string, false, - !no_abs_paths_flag); - /* No matter what no_abs_paths_flag setting is, strip - leading `./' from the filename. */ - while (*p == '.' && *(p + 1) == '/') - { - ++p; - while (*p == '/') - ++p; - } + cpio_safer_name_suffix (input_name.ds_string, false, + !no_abs_paths_flag, true); #ifndef HPUX_CDF - file_hdr.c_name = p; - file_hdr.c_namesize = strlen (p) + 1; + file_hdr.c_name = input_name.ds_string; + file_hdr.c_namesize = strlen (input_name.ds_string) + 1; #else if ( (archive_format != arf_tar) && (archive_format != arf_ustar) ) { @@ -536,7 +527,7 @@ process_copy_out () properly recreate the directory as hidden (in case the files of a directory go into the archive before the directory itself (e.g from "find ... -depth ... | cpio")). */ - file_hdr.c_name = add_cdf_double_slashes (p); + file_hdr.c_name = add_cdf_double_slashes (input_name.ds_string); file_hdr.c_namesize = strlen (file_hdr.c_name) + 1; } else @@ -544,8 +535,8 @@ process_copy_out () /* We don't mark CDF's in tar files. We assume the "hidden" directory will always go into the archive before any of its files. */ - file_hdr.c_name = p; - file_hdr.c_namesize = strlen (p) + 1; + file_hdr.c_name = input_name.ds_string; + file_hdr.c_namesize = strlen (input_name.ds_string) + 1; } #endif if ((archive_format == arf_tar || archive_format == arf_ustar) @@ -734,7 +725,7 @@ process_copy_out () file_hdr.c_filesize = 0; file_hdr.c_namesize = 11; - file_hdr.c_name = "TRAILER!!!"; + file_hdr.c_name = CPIO_TRAILER_NAME; if (archive_format != arf_tar && archive_format != arf_ustar) write_out_header (&file_hdr, out_file_des); else |