]> Dogcows Code - chaz/tar/blobdiff - src/extract.c
(xclose, xdup2, child_open_for_compress, child_open_for_uncompress,
[chaz/tar] / src / extract.c
index aa699805eee3d0e68d0dd698bba4038b267df452..9d47c58bcd8b1fdc04799bcc1cf7e1c54fcc3f91 100644 (file)
@@ -155,8 +155,6 @@ set_stat (char *file_name, struct stat *stat_info, int symlink_flag)
 
   if (0 < same_owner_option)
     {
-#if HAVE_LCHOWN
-
       /* When lchown exists, it should be used to change the attributes of
         the symbolic link itself.  In this case, a mere chown would change
         the attributes of the file the symbolic link is pointing to, and
@@ -164,11 +162,13 @@ set_stat (char *file_name, struct stat *stat_info, int symlink_flag)
 
       if (symlink_flag)
        {
+#if HAVE_LCHOWN
          if (lchown (file_name, stat_info->st_uid, stat_info->st_gid) < 0)
            ERROR ((0, errno, _("%s: Cannot lchown to uid %lu gid %lu"),
                    file_name,
                    (unsigned long) stat_info->st_uid,
                    (unsigned long) stat_info->st_gid));
+#endif
        }
       else
        {
@@ -177,28 +177,13 @@ set_stat (char *file_name, struct stat *stat_info, int symlink_flag)
                    file_name,
                    (unsigned long) stat_info->st_uid,
                    (unsigned long) stat_info->st_gid));
-       }
-
-#else /* not HAVE_LCHOWN */
 
-      if (!symlink_flag)
-
-       if (chown (file_name, stat_info->st_uid, stat_info->st_gid) < 0)
-         ERROR ((0, errno, _("%s: Cannot chown to uid %lu gid %lu"),
-                 file_name,
-                 (unsigned long) stat_info->st_uid,
-                 (unsigned long) stat_info->st_gid));
-
-#endif/* not HAVE_LCHOWN */
-
-      if (!symlink_flag)
-
-       /* On a few systems, and in particular, those allowing to give files
-          away, changing the owner or group destroys the suid or sgid bits.
-          So let's attempt setting these bits once more.  */
-
-       if (stat_info->st_mode & (S_ISUID | S_ISGID | S_ISVTX))
-         set_mode (file_name, stat_info);
+         /* On a few systems, and in particular, those allowing to give files
+            away, changing the owner or group destroys the suid or sgid bits.
+            So let's attempt setting these bits once more.  */
+         if (stat_info->st_mode & (S_ISUID | S_ISGID | S_ISVTX))
+           set_mode (file_name, stat_info);
+       }
     }
 }
 
@@ -258,7 +243,7 @@ make_directories (char *file_name)
       break;
     }
 
-  errno = saved_errno;         /* FIXME: errno should be read-only */
+  errno = saved_errno;
   return did_something;                /* tell them to retry if we made one */
 }
 
@@ -663,7 +648,7 @@ extract_archive (void)
 
            if (written > size)
              written = size;
-           errno = 0;          /* FIXME: errno should be read-only */
+           errno = 0;
            sstatus = full_write (fd, data_block->buffer, written);
 
            set_next_block_after ((union block *)
@@ -901,7 +886,7 @@ extract_archive (void)
              if (stat (CURRENT_FILE_NAME, &st1) == 0 && S_ISDIR (st1.st_mode))
                goto check_perms;
 
-             errno = saved_errno; /* FIXME: errno should be read-only */
+             errno = saved_errno;
            }
 
          if (maybe_recoverable (CURRENT_FILE_NAME))
This page took 0.028275 seconds and 4 git commands to generate.