rpms/unix2dos/devel unix2dos-preserve-file-modes.patch, NONE, 1.1 unix2dos.spec, 1.28, 1.29

Tim Waugh twaugh at fedoraproject.org
Mon Sep 8 08:57:31 UTC 2008


Author: twaugh

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

Modified Files:
	unix2dos.spec 
Added Files:
	unix2dos-preserve-file-modes.patch 
Log Message:
* Mon Sep  8 2008 Tim Waugh <twaugh at redhat.com> 2.2-31
- Preserve file modes (bug #437469).


unix2dos-preserve-file-modes.patch:

--- NEW FILE unix2dos-preserve-file-modes.patch ---
diff -up unix2dos-2.2/unix2dos.c~ unix2dos-2.2/unix2dos.c
--- unix2dos-2.2/unix2dos.c~	2008-03-03 13:16:34.000000000 +0000
+++ unix2dos-2.2/unix2dos.c	2008-03-03 13:22:10.000000000 +0000
@@ -244,10 +244,11 @@ int ConvertUnixToDosNewFile(char *ipInFN
   char *TempPath;
   struct stat StatBuf;
   struct utimbuf UTimeBuf;
+  mode_t mask;
   int fd;
 
   /* retrieve ipInFN file date stamp */
-  if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
+  if (stat(ipInFN, &StatBuf))
     RetVal = -1;
 
   if((fd = MakeTempFileFrom (ipOutFN, &TempPath)) < 0) {
@@ -271,6 +272,12 @@ int ConvertUnixToDosNewFile(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) && (ConvertUnixToDos(InF, TempF, ipFlag)))
     RetVal = -1;


Index: unix2dos.spec
===================================================================
RCS file: /cvs/pkgs/rpms/unix2dos/devel/unix2dos.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- unix2dos.spec	8 Sep 2008 08:50:37 -0000	1.28
+++ unix2dos.spec	8 Sep 2008 08:57:00 -0000	1.29
@@ -10,6 +10,7 @@
 Patch2: unix2dos-2.2-manpage.patch
 Patch3: unix2dos-2.2-mode.patch
 Patch4: unix2dos-2.2-tmppath.patch
+Patch5: unix2dos-preserve-file-modes.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 %prep
@@ -19,6 +20,7 @@
 %patch2 -p1 -b .man
 %patch3 -p1 -b .mode
 %patch4 -p1 -b .tmppath
+%patch5 -p1 -b .preserve-file-modes
 perl -pi -e "s/^#endif.*/#endif/g;s/^#else.*/#else/g" *.[ch]
 
 %description
@@ -45,6 +47,7 @@
 
 %changelog
 * Mon Sep  8 2008 Tim Waugh <twaugh at redhat.com> 2.2-31
+- Preserve file modes (bug #437469).
 - Fixed grammar in man page (bug #460731).
 - Explicitly apply patch0.
 




More information about the fedora-extras-commits mailing list