bug-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNATS tempfile patch


From: Mike Heffner
Subject: Re: GNATS tempfile patch
Date: Wed, 25 Apr 2001 17:44:13 -0400 (EDT)

On 25-Apr-2001 Kris Kennaway wrote:
| ..and here's part II, fixing the C code to use mkstemp() if available,
| instead of mktemp().  Please review, etc.
|
| --- gnats/cmds.c.orig Wed Mar 17 15:45:36 1999
| +++ gnats/cmds.c      Wed Apr 25 02:24:59 2001
| @@ -121,19 +121,33 @@

[snip]
  
| +#ifdef HAVE_MKSTEMP
| +  if ((tf = fdopen (fd, "w")) == (FILE *) NULL)
| +#else
|    if ((tf = fopen (path, "w")) == (FILE *) NULL)
| +#endif

If we're using mkstemp(), we could get here and the fdopen() could fail, but we
still have created the tempfile. I think there needs to be an unlink() within
#ifdef HAVE_MKSTEMP to remove the file on failure.


| --- gnats/internal.c.orig     Tue Mar  2 16:18:53 1999
| +++ gnats/internal.c  Wed Apr 25 02:24:45 2001
| @@ -36,20 +36,38 @@

[snip]

| +#ifdef HAVE_MKSTEMP
| +  fp = fdopen (fd, "w");
| +#else
|    fp = fopen (workfile, "w");
| +#endif
|    if (fp == NULL)

Same here.

Otherwise, looks good =)


Mike

-- 
  Mike Heffner       <mheffner@vt.edu>
  Blacksburg, VA   <mikeh@FreeBSD.org>
  http://filebox.vt.edu/users/mheffner

Attachment: pgpM_7nOqhpVN.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]