summaryrefslogtreecommitdiff
blob: 6103a2d088ddf31b9bd3f66602cd88dfa9d53d88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Submitted By: LFS Book <lfs-book@linuxfromscratch.org>
Date: 2003-10-05
Initial Package Version: 0.2
Origin: Slackware Source
Description: Use mkstemp instead of mktemp.
diff -Naur ed-0.2/buf.c ed-0.2-2/buf.c
--- ed-0.2/buf.c	Sat Nov 19 04:37:59 1994
+++ ed-0.2-2/buf.c	Tue May 28 18:38:23 2002
@@ -200,13 +200,13 @@
 int
 open_sbuf ()
 {
-  char *mktemp ();
-  int u;
+  int u, sfd;
 
   isbinary = newline_added = 0;
   u = umask(077);
   strcpy (sfn, "/tmp/ed.XXXXXX");
-  if (mktemp (sfn) == NULL || (sfp = fopen (sfn, "w+")) == NULL)
+  sfd = mkstemp(sfn);
+    if ((sfd == -1) || (sfp = fopen (sfn, "w+")) == NULL)
     {
       fprintf (stderr, "%s: %s\n", sfn, strerror (errno));
       sprintf (errmsg, "Cannot open temp file");