Make this compile, remove an tmpname/fopen race.

This commit is contained in:
angelos 1999-09-03 16:40:30 +00:00
parent 9ffb8561b3
commit 5d7c398598
3 changed files with 47 additions and 4 deletions

View File

@ -1,6 +1,7 @@
# $OpenBSD: Makefile,v 1.3 1999/09/02 22:12:39 brad Exp $
# $OpenBSD: Makefile,v 1.4 1999/09/03 16:40:30 angelos Exp $
DISTNAME= wbd-1.0ucl4
DISTNAME= wbd
DISTFILES= wbd-1.0ucl4.tar.gz
CATEGORIES= mbone
MASTER_SITES= http://www-mice.cs.ucl.ac.uk/multimedia/software/wbd/1.0ucl4/
ONLY_FOR_ARCHS= i386

View File

@ -1,5 +1,5 @@
*** Makefile.orig Thu Jan 29 06:46:41 1998
--- Makefile Thu Jul 15 10:29:16 1999
*** makefile.orig Thu Jan 29 06:46:41 1998
--- makefile Thu Jul 15 10:29:16 1999
***************
*** 3,14 ****

View File

@ -0,0 +1,42 @@
*** comms.c.orig Fri Sep 3 12:27:47 1999
--- comms.c Fri Sep 3 12:35:34 1999
***************
*** 1260,1266 ****
struct action *action = NULL;
struct pk_draw_msg *message = NULL;
char arg[LEN];
! char filename[L_tmpnam] = "";
FILE *tmpfile;
int i, result;
--- 1260,1266 ----
struct action *action = NULL;
struct pk_draw_msg *message = NULL;
char arg[LEN];
! char filename[L_tmpnam] = "wbd.XXXXXXXX";
FILE *tmpfile;
int i, result;
***************
*** 1287,1299 ****
}
/* Dump the PostScript to a temp file. */
! if (tmpnam (filename) == NULL)
! {
! printf ("Failed to create temp file.\n");
! return -1;
! }
! tmpfile = fopen (filename, "wb");
! if (tmpfile == NULL)
{
printf ("Failed to create temp file.\n");
return -1;
--- 1287,1293 ----
}
/* Dump the PostScript to a temp file. */
! if ((tmpfile = fdopen(mkstemp(filename), "wb")) == NULL)
{
printf ("Failed to create temp file.\n");
return -1;