aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/copyout.c20
-rw-r--r--src/copypass.c11
-rw-r--r--src/makepath.c27
-rw-r--r--src/util.c182
4 files changed, 1 insertions, 239 deletions
diff --git a/src/copyout.c b/src/copyout.c
index 7532dac..71abc4d 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -659,27 +659,7 @@ process_copy_out ()
assign_string (&orig_file_name, input_name.ds_string);
cpio_safer_name_suffix (input_name.ds_string, false,
!no_abs_paths_flag, true);
-#ifndef HPUX_CDF
cpio_set_c_name (&file_hdr, input_name.ds_string);
-#else
- if ( (archive_format != arf_tar) && (archive_format != arf_ustar) )
- {
- /* We mark CDF's in cpio files by adding a 2nd `/' after the
- "hidden" directory name. We need to do this so we can
- 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")). */
- cpio_set_c_name (&file_hdr,
- add_cdf_double_slashes (input_name.ds_string));
- }
- else
- {
- /* 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. */
- cpio_set_c_name (&file_hdr, input_name.ds_string);
- }
-#endif
/* Copy the named file to the output. */
switch (file_hdr.c_mode & CP_IFMT)
diff --git a/src/copypass.c b/src/copypass.c
index d94e347..26b453b 100644
--- a/src/copypass.c
+++ b/src/copypass.c
@@ -60,10 +60,6 @@ process_copy_pass ()
int in_file_des; /* Input file descriptor. */
int out_file_des; /* Output file descriptor. */
int existing_dir; /* True if file is a dir & already exists. */
-#ifdef HPUX_CDF
- int cdf_flag;
- int cdf_char;
-#endif
newdir_umask = umask (0); /* Reset umask to preserve modes of
created files */
@@ -120,13 +116,6 @@ process_copy_pass ()
/* Make the name of the new file. */
for (slash = input_name.ds_string; *slash == '/'; ++slash)
;
-#ifdef HPUX_CDF
- /* For CDF's we add a 2nd `/' after all "hidden" directories.
- This kind of a kludge, but it's what we do when creating
- archives, and it's easier to do this than to separately
- keep track of which directories in a path are "hidden". */
- slash = add_cdf_double_slashes (slash);
-#endif
ds_resize (&output_name, dirname_len + strlen (slash) + 2);
strcpy (output_name.ds_string + dirname_len + 1, slash);
diff --git a/src/makepath.c b/src/makepath.c
index b5f99c6..0e2184c 100644
--- a/src/makepath.c
+++ b/src/makepath.c
@@ -74,24 +74,9 @@ make_path (char *argpath,
slash++;
while ((slash = strchr (slash, '/')))
{
-#ifdef HPUX_CDF
- int iscdf;
- iscdf = 0;
-#endif
*slash = '\0';
if (stat (dirpath, &stats))
{
-#ifdef HPUX_CDF
- /* If this component of the pathname ends in `+' and is
- followed by 2 `/'s, then this is a CDF. We remove the
- `+' from the name and create the directory. Later
- we will "hide" the directory. */
- if ( (*(slash +1) == '/') && (*(slash -1) == '+') )
- {
- iscdf = 1;
- *(slash -1) = '\0';
- }
-#endif
if (mkdir (dirpath, tmpmode ^ invert_permissions))
{
error (0, errno, _("cannot make directory `%s'"), dirpath);
@@ -113,18 +98,6 @@ make_path (char *argpath,
delay_set_stat (dirpath, &stats, invert_permissions);
}
-
-#ifdef HPUX_CDF
- if (iscdf)
- {
- /* If this is a CDF, "hide" the directory by setting
- its hidden/setuid bit. Also add the `+' back to
- its name (since once it's "hidden" we must refer
- to as `name+' instead of `name'). */
- chmod (dirpath, 04700);
- *(slash - 1) = '+';
- }
-#endif
}
}
else if (!S_ISDIR (stats.st_mode))
diff --git a/src/util.c b/src/util.c
index 7303240..0e40134 100644
--- a/src/util.c
+++ b/src/util.c
@@ -601,20 +601,8 @@ void
create_all_directories (char *name)
{
char *dir;
-#ifdef HPUX_CDF
- int cdf;
-#endif
dir = dir_name (name);
-#ifdef HPUX_CDF
- cdf = islastparentcdf (name);
- if (cdf)
- {
- dir [strlen (dir) - 1] = '\0'; /* remove final + */
- mode = 04700;
- }
-
-#endif
if (dir == NULL)
error (PAXEXIT_FAILURE, 0, _("virtual memory exhausted"));
@@ -1003,146 +991,6 @@ umasked_symlink (char *name1, char *name2, int mode)
}
#endif /* SYMLINK_USES_UMASK */
-#ifdef HPUX_CDF
-/* When we create a cpio archive we mark CDF's by putting an extra `/'
- after their component name so we can distinguish the CDF's when we
- extract the archive (in case the "hidden" directory's files appear
- in the archive before the directory itself). E.g., in the path
- "a/b+/c", if b+ is a CDF, we will write this path as "a/b+//c" in
- the archive so when we extract the archive we will know that b+
- is actually a CDF, and not an ordinary directory whose name happens
- to end in `+'. We also do the same thing internally in copypass.c. */
-
-
-/* Take an input pathname and check it for CDF's. Insert an extra
- `/' in the pathname after each "hidden" directory. If we add
- any `/'s, return a malloced string instead of the original input
- string.
- FIXME: This creates a memory leak.
-*/
-
-char *
-add_cdf_double_slashes (char *input_name)
-{
- static char *ret_name = NULL; /* re-usuable return buffer (malloc'ed) */
- static int ret_size = -1; /* size of return buffer. */
- char *p;
- char *q;
- int n;
- struct stat dir_stat;
-
- /* Search for a `/' preceeded by a `+'. */
-
- for (p = input_name; *p != '\0'; ++p)
- {
- if ( (*p == '+') && (*(p + 1) == '/') )
- break;
- }
-
- /* If we didn't find a `/' preceeded by a `+' then there are
- no CDF's in this pathname. Return the original pathname. */
-
- if (*p == '\0')
- return input_name;
-
- /* There was a `/' preceeded by a `+' in the pathname. If it is a CDF
- then we will need to copy the input pathname to our return
- buffer so we can insert the extra `/'s. Since we can't tell
- yet whether or not it is a CDF we will just always copy the
- string to the return buffer. First we have to make sure the
- buffer is large enough to hold the string and any number of
- extra `/'s we might add. */
-
- n = 2 * (strlen (input_name) + 1);
- if (n >= ret_size)
- {
- if (ret_size < 0)
- ret_name = (char *) malloc (n);
- else
- ret_name = (char *)realloc (ret_name, n);
- ret_size = n;
- }
-
- /* Clear the `/' after this component, so we can stat the pathname
- up to and including this component. */
- ++p;
- *p = '\0';
- if ((*xstat) (input_name, &dir_stat) < 0)
- {
- stat_error (input_name);
- return input_name;
- }
-
- /* Now put back the `/' after this component and copy the pathname up to
- and including this component and its trailing `/' to the return
- buffer. */
- *p++ = '/';
- strncpy (ret_name, input_name, p - input_name);
- q = ret_name + (p - input_name);
-
- /* If it was a CDF, add another `/'. */
- if (S_ISDIR (dir_stat.st_mode) && (dir_stat.st_mode & 04000) )
- *q++ = '/';
-
- /* Go through the rest of the input pathname, copying it to the
- return buffer, and adding an extra `/' after each CDF. */
- while (*p != '\0')
- {
- if ( (*p == '+') && (*(p + 1) == '/') )
- {
- *q++ = *p++;
-
- *p = '\0';
- if ((*xstat) (input_name, &dir_stat) < 0)
- {
- stat_error (input_name);
- return input_name;
- }
- *p = '/';
-
- if (S_ISDIR (dir_stat.st_mode) && (dir_stat.st_mode & 04000) )
- *q++ = '/';
- }
- *q++ = *p++;
- }
- *q = '\0';
-
- return ret_name;
-}
-
-/* Is the last parent directory (e.g., c in a/b/c/d) a CDF? If the
- directory name ends in `+' and is followed by 2 `/'s instead of 1
- then it is. This is only the case for cpio archives, but we don't
- have to worry about tar because tar always has the directory before
- its files (or else we lose). */
-int
-islastparentcdf (char *path)
-{
- char *newpath;
- char *slash;
- int slash_count;
- int length; /* Length of result, not including NUL. */
-
- slash = strrchr (path, '/');
- if (slash == 0)
- return 0;
- else
- {
- slash_count = 0;
- while (slash > path && *slash == '/')
- {
- ++slash_count;
- --slash;
- }
-
-
- if ( (*slash == '+') && (slash_count >= 2) )
- return 1;
- }
- return 0;
-}
-#endif
-
#define DISKBLOCKSIZE (512)
static int
@@ -1382,12 +1230,6 @@ set_perms (int fd, struct cpio_file_stat *header)
/* chown may have turned off some permissions we wanted. */
if (fchmod_or_chmod (fd, header->c_name, header->c_mode) < 0)
chmod_error_details (header->c_name, header->c_mode);
-#ifdef HPUX_CDF
- if ((header->c_mode & CP_IFMT) && cdf_flag)
- /* Once we "hide" the directory with the chmod(),
- we have to refer to it using name+ instead of name. */
- file_hdr->c_name [cdf_char] = '+';
-#endif
if (retain_time_flag)
set_file_times (fd, header->c_name, header->c_mtime, header->c_mtime);
}
@@ -1592,10 +1434,6 @@ int
cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir)
{
int res; /* Result of various function calls. */
-#ifdef HPUX_CDF
- int cdf_flag; /* True if file is a CDF. */
- int cdf_char; /* Index of `+' char indicating a CDF. */
-#endif
int setstat_delayed = 0;
if (to_stdout_option)
@@ -1614,26 +1452,8 @@ cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir)
return 0;
}
-#ifdef HPUX_CDF
- cdf_flag = 0;
-#endif
if (!existing_dir)
- {
-#ifdef HPUX_CDF
- /* If the directory name ends in a + and is SUID,
- then it is a CDF. Strip the trailing + from
- the name before creating it. */
- cdf_char = strlen (file_hdr->c_name) - 1;
- if ( (cdf_char > 0) &&
- (file_hdr->c_mode & 04000) &&
- (file_hdr->c_name [cdf_char] == '+') )
- {
- file_hdr->c_name [cdf_char] = '\0';
- cdf_flag = 1;
- }
-#endif
- res = cpio_mkdir (file_hdr, &setstat_delayed);
- }
+ res = cpio_mkdir (file_hdr, &setstat_delayed);
else
res = 0;
if (res < 0 && create_dir_flag)

Return to:

Send suggestions and report system problems to the System administrator.