From bbbfe0f4ec4d131a7c40ca817dc0e67b0d7f2d41 Mon Sep 17 00:00:00 2001 From: cvsdist Date: Thu, 9 Sep 2004 04:19:26 +0000 Subject: [PATCH] =?UTF-8?q?auto-import=20changelog=20data=20from=20dos2uni?= =?UTF-8?q?x-3.1-10.src.rpm=20Thu=20Feb=2028=202002=20Trond=20Eivind=20Glo?= =?UTF-8?q?msr=F8d=20=203.1-10=20-=20Build=20in=20new=20en?= =?UTF-8?q?vironment=20Thu=20Jan=2017=202002=20Bernhard=20Rosenkraenzer=20?= =?UTF-8?q?=20-=20Fix=20bug=20#57700=20(segfault)=20-=20A?= =?UTF-8?q?dd=20the=20mac2unix=20symlink=20recommended=20in=20README=20-?= =?UTF-8?q?=20Fix=20compiler=20warnings=20Wed=20Jan=2009=202002=20Tim=20Po?= =?UTF-8?q?wers=20=20-=20automated=20rebuild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dos2unix-3.1-segfault.patch | 93 +++++++++++++++++++++++++++++++++++++ dos2unix.spec | 24 ++++++++-- 2 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 dos2unix-3.1-segfault.patch diff --git a/dos2unix-3.1-segfault.patch b/dos2unix-3.1-segfault.patch new file mode 100644 index 0000000..7c8391b --- /dev/null +++ b/dos2unix-3.1-segfault.patch @@ -0,0 +1,93 @@ +--- dos2unix-3.1/dos2unix.c.segf Thu Jan 17 17:27:42 2002 ++++ dos2unix-3.1/dos2unix.c Thu Jan 17 17:28:07 2002 +@@ -147,9 +147,9 @@ + * RetVal: NULL if failure + * file stream otherwise + */ +-FILE* OpenOutFile(char *ipFN) ++FILE* OpenOutFile(int fd) + { +- return (fopen(ipFN, W_CNTRL)); ++ return (fdopen(fd, W_CNTRL)); + } + + +@@ -260,14 +260,17 @@ + char TempPath[16]; + struct stat StatBuf; + struct utimbuf UTimeBuf; ++ int fd; + + /* retrieve ipInFN file date stamp */ + if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf)) + RetVal = -1; + +- strcpy (TempPath, "./d2utmp"); +- strcat (TempPath, "XXXXXX"); +- mkstemp (TempPath); ++ strcpy (TempPath, "./d2utmpXXXXXX"); ++ if((fd=mkstemp (TempPath))<0) { ++ perror("Failed to open output temp file"); ++ RetVal = -1; ++ } + + #ifdef DEBUG + fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath); +@@ -278,7 +281,7 @@ + RetVal = -1; + + /* can open out file? */ +- if ((!RetVal) && (InF) && ((TempF=OpenOutFile(TempPath)) == NULL)) ++ if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL)) + { + fclose (InF); + RetVal = -1; +@@ -295,6 +298,8 @@ + /* can close out file? */ + if ((TempF) && (fclose(TempF) == EOF)) + RetVal = -1; ++ if(fd>=0) ++ close(fd); + + if ((!RetVal) && (ipFlag->KeepDate)) + { +@@ -340,14 +345,17 @@ + char TempPath[16]; + struct stat StatBuf; + struct utimbuf UTimeBuf; ++ int fd; + + /* retrieve ipInFN file date stamp */ + if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf)) + RetVal = -1; + +- strcpy (TempPath, "./u2dtmp"); +- strcat (TempPath, "XXXXXX"); +- mkstemp (TempPath); ++ strcpy (TempPath, "./u2dtmpXXXXXX"); ++ if((fd=mkstemp (TempPath))<0) { ++ perror("Failed to open output temp file"); ++ RetVal = -1; ++ } + + #ifdef DEBUG + fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath); +@@ -358,7 +366,7 @@ + RetVal = -1; + + /* can open out file? */ +- if ((!RetVal) && (InF) && ((TempF=OpenOutFile(TempPath)) == NULL)) ++ if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL)) + { + fclose (InF); + RetVal = -1; +@@ -376,6 +384,9 @@ + if ((TempF) && (fclose(TempF) == EOF)) + RetVal = -1; + ++ if(fd>=0) ++ close(fd); ++ + if ((!RetVal) && (ipFlag->KeepDate)) + { + UTimeBuf.actime = StatBuf.st_atime; diff --git a/dos2unix.spec b/dos2unix.spec index a8157df..255b2f3 100644 --- a/dos2unix.spec +++ b/dos2unix.spec @@ -1,12 +1,13 @@ Summary: Text file format converter Name: dos2unix Version: 3.1 -Release: 7 +Release: 10 Group: Applications/Text -Copyright: Freely distributable +License: Freely distributable Source: %{name}-%{version}.tar.bz2 Patch0: %{name}-%{version}.patch -Buildroot: %{_tmppath}/%{name}-root +Patch1: dos2unix-3.1-segfault.patch +Buildroot: %{_tmppath}/%{name}-%{version}-root %description Dos2unix converts DOS or MAC text files to UNIX format. @@ -14,28 +15,45 @@ Dos2unix converts DOS or MAC text files to UNIX format. %prep %setup -q %patch0 -p1 -b .orig +%patch1 -p1 -b .segf +perl -pi -e 's,(#endif|#else)[^ ]*(.*),$1 /* $2 */,g' *.[ch] %build make clean make CFLAGS="$RPM_OPT_FLAGS" +make link %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1} install -m755 dos2unix $RPM_BUILD_ROOT%{_bindir} +install -m755 mac2unix $RPM_BUILD_ROOT%{_bindir} install -m444 dos2unix.1 $RPM_BUILD_ROOT%{_mandir}/man1 +install -m444 mac2unix.1 $RPM_BUILD_ROOT%{_mandir}/man1 %files %defattr(-,root,root,0755) %doc COPYRIGHT %{_bindir}/dos2unix +%{_bindir}/mac2unix %{_mandir}/*/* %clean rm -rf $RPM_BUILD_ROOT %changelog +* Thu Feb 28 2002 Trond Eivind Glomsrød 3.1-10 +- Build in new environment + +* Thu Jan 17 2002 Bernhard Rosenkraenzer +- Fix bug #57700 (segfault) +- Add the mac2unix symlink recommended in README +- Fix compiler warnings + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + * Sun Jun 24 2001 Elliot Lee - Bump release + rebuild.