Репозитории ALT
S: | 1.13-alt2 |
5.1: | 1.3.5-alt6 |
4.1: | 1.3.5-alt4.M40.1 |
4.0: | 1.3.5-alt4.M40.1 |
3.0: | 1.3.5-alt2 |
+updates: | 1.3.5-alt2.M30.1 |
Другие репозитории
Upstream: | 1.3.12 |
Группа :: Архивирование/Сжатие
Пакет: gzip
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: gzip-1.3.5-alt-copy_stat.patch
Скачать
Скачать
diff -upk.orig gzip-1.3.5.orig/gzip.c gzip-1.3.5/gzip.c
--- gzip-1.3.5.orig/gzip.c 2005-05-19 17:00:28 +0000
+++ gzip-1.3.5/gzip.c 2005-05-19 17:29:22 +0000
@@ -878,8 +878,9 @@ local void treat_file(iname)
}
close(ifd);
- if (!to_stdout && close(ofd)) {
- write_error();
+ /* Copy modes, times, ownership, and remove the input file */
+ if (!to_stdout && method != -1) {
+ copy_stat(&istat);
}
if (method == -1) {
if (!to_stdout) xunlink (ofname);
@@ -899,10 +900,6 @@ local void treat_file(iname)
}
fprintf(stderr, "\n");
}
- /* Copy modes, times, ownership, and remove the input file */
- if (!to_stdout) {
- copy_stat(&istat);
- }
}
/* ========================================================================
@@ -1720,17 +1717,8 @@ local void reset_times (name, statb)
local void copy_stat(ifstat)
struct stat *ifstat;
{
-#ifndef NO_UTIME
- if (decompress && time_stamp != 0 && ifstat->st_mtime != time_stamp) {
- ifstat->st_mtime = time_stamp;
- if (verbose > 1) {
- fprintf(stderr, "%s: time stamp restored\n", ofname);
- }
- }
- reset_times(ofname, ifstat);
-#endif
/* Copy the protection modes */
- if (chmod(ofname, ifstat->st_mode & 07777)) {
+ if (fchmod(ofd, ifstat->st_mode & 07777)) {
int e = errno;
WARN((stderr, "%s: ", progname));
if (!quiet) {
@@ -1739,9 +1727,20 @@ local void copy_stat(ifstat)
}
}
#ifndef NO_CHOWN
- chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
+ fchown(ofd, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
#endif
+ if (close(ofd))
+ write_error();
remove_ofname = 0;
+#ifndef NO_UTIME
+ if (decompress && time_stamp != 0 && ifstat->st_mtime != time_stamp) {
+ ifstat->st_mtime = time_stamp;
+ if (verbose > 1) {
+ fprintf(stderr, "%s: time stamp restored\n", ofname);
+ }
+ }
+ reset_times(ofname, ifstat);
+#endif
/* It's now safe to remove the input file: */
if (xunlink (ifname)) {
int e = errno;