add the mktemp -> mkstemp patches

This commit is contained in:
marc 1998-07-25 04:19:28 +00:00
parent 91d3a00c81
commit 9fc633cff3
4 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,19 @@
--- io.c.~1~ Thu Mar 7 09:34:42 1996
+++ io.c Fri Jul 24 19:17:53 1998
@@ -1193,10 +1193,16 @@
#endif
);
tfname = copystr(buf);
+#if 0
tfname = mktemp(tfname);
+#endif
#ifndef MSFILESYSTEM
+#if 1
+ tmpfd = mkstemp(tfname);
+#else
(void) close(creat(tfname, 0600));
tmpfd = open(tfname, 2);
+#endif
#else /* MSFILESYSTEM */
tmpfd = open(tfname, O_CREAT|O_EXCL|O_BINARY|O_RDWR, S_IWRITE|S_IREAD);
#endif /* MSFILESYSTEM */

View File

@ -0,0 +1,19 @@
--- abbrev.c.~1~ Thu Mar 7 09:34:41 1996
+++ abbrev.c Fri Jul 24 19:22:45 1998
@@ -274,7 +274,16 @@
"jabbXXXXXX"
#endif
);
+#if 1
+ {
+ int fd = mkstemp(tname);
+ if ( fd == -1 )
+ err( 1, "can't create temp file %s", tname );
+ close( fd );
+ }
+#else
(void) mktemp(tname);
+#endif
save_abbrevs(tname);
setfname(ebuf, tname);
read_file(tname, NO);

View File

@ -0,0 +1,15 @@
--- rec.c.~1~ Thu Mar 7 09:34:43 1996
+++ rec.c Fri Jul 24 19:25:22 1998
@@ -55,8 +55,12 @@
#endif
);
recfname = copystr(buf);
+#if 1
+ rec_fd = mkstemp(recfname);
+#else
recfname = mktemp(recfname);
rec_fd = creat(recfname, 0644);
+#endif
if (rec_fd == -1) {
complain("Cannot create \"%s\"; recovery disabled.", recfname);
/*NOTREACHED*/

View File

@ -0,0 +1,37 @@
--- proc.c.orig Fri Mar 8 13:46:40 1996
+++ proc.c Fri Jul 24 19:42:45 1998
@@ -827,8 +827,14 @@
int ph;
swritef(pnbuf, sizeof(pnbuf), "%s/%s", TmpDir, "jpXXXXXX");
+#if 1
+ pipename = pnbuf;
+ ph = mkstemp( pipename );
+#else
pipename = mktemp(pnbuf);
- if ((ph = creat(pipename, S_IWRITE|S_IREAD)) < 0)
+ ph = creat(pipename, S_IWRITE|S_IREAD);
+#endif
+ if (ph == -1)
complain("cannot make pipe for filter: %s", strerror(errno));
close(1);
close(2);
@@ -923,7 +929,18 @@
jmp_buf sav_jmp;
swritef(tnambuf, sizeof(tnambuf), "%s/%s", TmpDir, "jfXXXXXX");
+#if 1
+ {
+ int fd = mkstemp(tnambuf);
+ if ( fd == -1 )
+ complain( "can't create temp file %s: %s",
+ tnambuf, strerror(errno) );
+ close( fd );
+ tname = tnambuf;
+ }
+#else
tname = mktemp(tnambuf);
+#endif
fp = open_file(tname, iobuff, F_WRITE, YES);
push_env(sav_jmp);
if (setjmp(mainjmp) == 0) {