rpms/dos2unix/devel dos2unix-preserve-file-modes.patch, NONE, 1.1 dos2unix.spec, 1.32, 1.33

Tim Waugh twaugh at fedoraproject.org
Mon Sep 8 09:18:26 UTC 2008


Author: twaugh

Update of /cvs/pkgs/rpms/dos2unix/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11617

Modified Files:
	dos2unix.spec 
Added Files:
	dos2unix-preserve-file-modes.patch 
Log Message:
* Mon Sep  8 2008 Tim Waugh <twaugh at redhat.com> 3.1-33
- Preserve file modes (bug #437465).


dos2unix-preserve-file-modes.patch:

--- NEW FILE dos2unix-preserve-file-modes.patch ---
diff -up dos2unix-3.1/dos2unix.c.preserve-file-modes dos2unix-3.1/dos2unix.c
--- dos2unix-3.1/dos2unix.c.preserve-file-modes	2008-09-08 09:58:05.000000000 +0100
+++ dos2unix-3.1/dos2unix.c	2008-09-08 10:16:04.000000000 +0100
@@ -320,9 +320,10 @@ int ConvertDosToUnixNewFile(char *ipInFN
   struct stat StatBuf;
   struct utimbuf UTimeBuf;
   int fd;
+  mode_t mask;
 
   /* retrieve ipInFN file date stamp */
-  if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
+  if (stat(ipInFN, &StatBuf))
     RetVal = -1;
 
   if((fd = MakeTempFileFrom(ipOutFN, &TempPath))<0) {
@@ -346,6 +347,12 @@ int ConvertDosToUnixNewFile(char *ipInFN
     RetVal = -1;
   }
 
+  /* preserve original mode as modified by umask */
+  mask = umask(0);
+  umask(mask);
+  if (!RetVal && fchmod(fd, StatBuf.st_mode & ~mask))
+    RetVal = -1;
+
   /* conversion sucessful? */
   if ((!RetVal) && (ConvertDosToUnix(InF, TempF, ipFlag)))
     RetVal = -1;


Index: dos2unix.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dos2unix/devel/dos2unix.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- dos2unix.spec	8 Sep 2008 09:00:34 -0000	1.32
+++ dos2unix.spec	8 Sep 2008 09:17:56 -0000	1.33
@@ -14,6 +14,7 @@
 Patch6: dos2unix-c-missing-arg.patch
 Patch7: dos2unix-missing-proto.patch
 Patch8: dos2unix-manpage.patch
+Patch9: dos2unix-preserve-file-modes.patch
 
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -31,6 +32,7 @@
 %patch6 -p1 -b .c-missing-arg
 %patch7 -p1 -b .missing-proto
 %patch8 -p1 -b .manpage
+%patch9 -p1 -b .preserve-file-modes
 
 for I in *.[ch]; do
 	sed -e 's,#endif.*,#endif,g' -e 's,#else.*,#else,g' $I > $I.new
@@ -63,6 +65,7 @@
 
 %changelog
 * Mon Sep  8 2008 Tim Waugh <twaugh at redhat.com> 3.1-33
+- Preserve file modes (bug #437465).
 - Fixed manpage grammar (bug #460731).
 
 * Mon Apr 14 2008 Tim Waugh <twaugh at redhat.com> 3.1-32




More information about the fedora-extras-commits mailing list