diff options
author | 2002-12-01 05:54:20 +0000 | |
---|---|---|
committer | 2002-12-01 05:54:20 +0000 | |
commit | db4d9e3bd4710f5117f41af053b18595e9ff326a (patch) | |
tree | ed4b431dda93167dc049fa71607b64f4a613cdc1 /app-text/dos2unix/files/dos2unix-3.1-segfault.patch | |
parent | Initial import. ~keyworded for testing. (diff) | |
download | gentoo-2-db4d9e3bd4710f5117f41af053b18595e9ff326a.tar.gz gentoo-2-db4d9e3bd4710f5117f41af053b18595e9ff326a.tar.bz2 gentoo-2-db4d9e3bd4710f5117f41af053b18595e9ff326a.zip |
initial ebuild #11242
Diffstat (limited to 'app-text/dos2unix/files/dos2unix-3.1-segfault.patch')
-rw-r--r-- | app-text/dos2unix/files/dos2unix-3.1-segfault.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/app-text/dos2unix/files/dos2unix-3.1-segfault.patch b/app-text/dos2unix/files/dos2unix-3.1-segfault.patch new file mode 100644 index 000000000000..7c8391bd2bdb --- /dev/null +++ b/app-text/dos2unix/files/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; |