mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.6 KiB

  1. --- gzip-1.3.5/gzip.c.perm 2005-04-26 14:22:58.211395152 +0200
  2. +++ gzip-1.3.5/gzip.c 2005-04-26 14:24:10.414418624 +0200
  3. @@ -881,6 +881,20 @@
  4. }
  5. close(ifd);
  6. + /* ofd ownership and permissions have to be set before close(ofd)*/
  7. + if (!to_stdout) {
  8. + if (fchmod(ofd, istat.st_mode & 07777)) {
  9. + int e = errno;
  10. + WARN((stderr, "%s: ", progname));
  11. + if (!quiet) {
  12. + errno = e;
  13. + perror(ofname);
  14. + }
  15. + }
  16. +#ifndef NO_CHOWN
  17. + fchown(ofd, istat.st_uid, istat.st_gid); /* Copy ownership */
  18. +#endif
  19. + }
  20. if (!to_stdout && close(ofd)) {
  21. write_error();
  22. }
  23. @@ -902,7 +916,7 @@
  24. }
  25. fprintf(stderr, "\n");
  26. }
  27. - /* Copy modes, times, ownership, and remove the input file */
  28. + /* Copy times and remove the input file */
  29. if (!to_stdout) {
  30. copy_stat(&istat);
  31. }
  32. @@ -1715,7 +1729,7 @@
  33. /* ========================================================================
  34. - * Copy modes, times, ownership from input file to output file.
  35. + * Copy times from input file to output file.
  36. * IN assertion: to_stdout is false.
  37. */
  38. local void copy_stat(ifstat)
  39. @@ -1730,18 +1744,6 @@
  40. }
  41. reset_times(ofname, ifstat);
  42. #endif
  43. - /* Copy the protection modes */
  44. - if (chmod(ofname, ifstat->st_mode & 07777)) {
  45. - int e = errno;
  46. - WARN((stderr, "%s: ", progname));
  47. - if (!quiet) {
  48. - errno = e;
  49. - perror(ofname);
  50. - }
  51. - }
  52. -#ifndef NO_CHOWN
  53. - chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
  54. -#endif
  55. remove_ofname = 0;
  56. /* It's now safe to remove the input file: */
  57. if (xunlink (ifname)) {