- utime (p, &restore_times);
- }
- return;
- }
-
-#ifdef HAVE_READLINK
- else if (S_ISLNK (current_stat.st_mode))
- {
- int size;
- char *buffer = (char *) alloca (PATH_MAX + 1);
-
- size = readlink (p, buffer, PATH_MAX + 1);
- if (size < 0)
- {
- WARN ((0, errno, _("Cannot add file %s"), p));
- if (!ignore_failed_read_option)
- exit_status = TAREXIT_FAILURE;
- return;
- }
- buffer[size] = '\0';
- if (size >= NAME_FIELD_SIZE)
- write_long (buffer, GNUTYPE_LONGLINK);
- assign_string (¤t_link_name, buffer);
-
- current_stat.st_size = 0; /* force 0 size on symlink */
- header = start_header (p, ¤t_stat);
- if (header == NULL)
- {
- exit_status = TAREXIT_FAILURE;
- return;
- }
- strncpy (header->header.linkname, buffer, NAME_FIELD_SIZE);
- header->header.linkname[NAME_FIELD_SIZE - 1] = '\0';
- header->header.typeflag = SYMTYPE;
- finish_header (header); /* nothing more to do to it */
- if (remove_files_option)
- {
- if (unlink (p) == -1)
- ERROR ((0, errno, _("Cannot remove %s"), p));
- }
- return;
- }
-#endif
-
- else if (S_ISDIR (current_stat.st_mode))
- {
- DIR *directory;
- struct dirent *entry;
- char *namebuf;
- size_t buflen;
- size_t len;
- dev_t our_device = current_stat.st_dev;
-
- /* If this tar program is installed suid root, like for Amanda, the
- access might look like denied, while it is not really.
-
- FIXME: I have the feeling this test is done too early. Couldn't it
- just be bundled in later actions? I guess that the proper support
- of --ignore-failed-read is the key of the current writing. */
-
- if (access (p, R_OK) == -1 && geteuid () != 0)
- {
- WARN ((0, errno, _("Cannot add directory %s"), p));
- if (!ignore_failed_read_option)
- exit_status = TAREXIT_FAILURE;