Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 63 lines (60 sloc) 1.751 kB
495f5aa @JohnSonnenschein initial import
JohnSonnenschein authored
1 --- gzip-1.3.5.orig/gzip.c
2 +++ gzip-1.3.5/gzip.c
3 @@ -878,8 +878,11 @@
4 }
5
6 close(ifd);
7 - if (!to_stdout && close(ofd)) {
8 - write_error();
9 + if (!to_stdout) {
10 + /* Copy modes, times, ownership, and remove the input file */
11 + copy_stat(&istat);
12 + if (close(ofd))
13 + write_error();
14 }
15 if (method == -1) {
16 if (!to_stdout) xunlink (ofname);
17 @@ -899,10 +902,6 @@
18 }
19 fprintf(stderr, "\n");
20 }
21 - /* Copy modes, times, ownership, and remove the input file */
22 - if (!to_stdout) {
23 - copy_stat(&istat);
24 - }
25 }
26
27 /* ========================================================================
28 @@ -1322,6 +1321,7 @@
29 /* Copy the base name. Keep a directory prefix intact. */
30 char *p = base_name (ofname);
31 char *base = p;
32 + char *base2;
33 for (;;) {
34 *p = (char)get_char();
35 if (*p++ == '\0') break;
36 @@ -1329,6 +1329,8 @@
37 error("corrupted input -- file name too large");
38 }
39 }
40 + base2 = base_name (base);
41 + strcpy(base, base2);
42 /* If necessary, adapt the name to local OS conventions: */
43 if (!list) {
44 MAKE_LEGAL_NAME(base);
45 @@ -1730,7 +1732,7 @@
46 reset_times(ofname, ifstat);
47 #endif
48 /* Copy the protection modes */
49 - if (chmod(ofname, ifstat->st_mode & 07777)) {
50 + if (fchmod(ofd, ifstat->st_mode & 07777)) {
51 int e = errno;
52 WARN((stderr, "%s: ", progname));
53 if (!quiet) {
54 @@ -1739,7 +1741,7 @@
55 }
56 }
57 #ifndef NO_CHOWN
58 - chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
59 + (void) fchown(ofd, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
60 #endif
61 remove_ofname = 0;
62 /* It's now safe to remove the input file: */
Something went wrong with that request. Please try again.