+ /* This symbolic link is potentially dangerous. Don't
+ create it now; instead, create a placeholder file, which
+ will be replaced after other extraction is done. */
+ struct stat st;
+
+ while (fd = open (CURRENT_FILE_NAME, O_WRONLY | O_CREAT | O_EXCL, 0),
+ fd < 0)
+ if (! maybe_recoverable (CURRENT_FILE_NAME, &interdir_made))
+ break;
+
+ status = -1;
+ if (fd < 0)
+ open_error (CURRENT_FILE_NAME);
+ else if (fstat (fd, &st) != 0)
+ {
+ stat_error (CURRENT_FILE_NAME);
+ close (fd);
+ }
+ else if (close (fd) != 0)
+ close_error (CURRENT_FILE_NAME);
+ else
+ {
+ size_t filelen = strlen (CURRENT_FILE_NAME);
+ size_t linklen = strlen (current_link_name);
+ struct delayed_symlink *p =
+ xmalloc (offsetof (struct delayed_symlink, target)
+ + linklen + 1);
+ p->next = delayed_symlink_head;
+ delayed_symlink_head = p;
+ p->dev = st.st_dev;
+ p->ino = st.st_ino;
+ p->mtime = st.st_mtime;
+ p->uid = current_stat.st_uid;
+ p->gid = current_stat.st_gid;
+ p->sources = xmalloc (offsetof (struct string_list, string)
+ + filelen + 1);
+ p->sources->next = 0;
+ memcpy (p->sources->string, CURRENT_FILE_NAME, filelen + 1);
+ memcpy (p->target, current_link_name, linklen + 1);
+ status = 0;
+ }