- Preserve file modes (bug #437465).
This commit is contained in:
parent
89e5715fc7
commit
1271138cb8
28
dos2unix-preserve-file-modes.patch
Normal file
28
dos2unix-preserve-file-modes.patch
Normal file
@ -0,0 +1,28 @@
|
||||
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;
|
@ -14,6 +14,7 @@ Patch5: dos2unix-3.1-tmppath.patch
|
||||
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 @@ Dos2unix converts DOS or MAC text files to UNIX format.
|
||||
%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 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
* Mon Sep 8 2008 Tim Waugh <twaugh@redhat.com> 3.1-33
|
||||
- Preserve file modes (bug #437465).
|
||||
- Fixed manpage grammar (bug #460731).
|
||||
|
||||
* Mon Apr 14 2008 Tim Waugh <twaugh@redhat.com> 3.1-32
|
||||
|
Loading…
Reference in New Issue
Block a user