Magellan Linux

Contents of /trunk/ed/patches/ed-0.2-mkstemp.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (show annotations) (download)
Tue May 8 20:06:05 2007 UTC (16 years, 11 months ago) by niro
File size: 568 byte(s)
-import

1 diff -Naur ed-0.2/buf.c ed-0.2-2/buf.c
2 --- ed-0.2/buf.c Sat Nov 19 04:37:59 1994
3 +++ ed-0.2-2/buf.c Tue May 28 18:38:23 2002
4 @@ -200,13 +200,13 @@
5 int
6 open_sbuf ()
7 {
8 - char *mktemp ();
9 - int u;
10 + int u, sfd;
11
12 isbinary = newline_added = 0;
13 u = umask(077);
14 strcpy (sfn, "/tmp/ed.XXXXXX");
15 - if (mktemp (sfn) == NULL || (sfp = fopen (sfn, "w+")) == NULL)
16 + sfd = mkstemp(sfn);
17 + if ((sfd == -1) || (sfp = fopen (sfn, "w+")) == NULL)
18 {
19 fprintf (stderr, "%s: %s\n", sfn, strerror (errno));
20 sprintf (errmsg, "Cannot open temp file");