Open temporary files with O_EXCL.

Obtained from:bugtraq
This commit is contained in:
guido 1998-03-06 19:00:26 +00:00
parent 68b354f908
commit f2be303d75

View File

@ -369,7 +369,7 @@ xtmpfopen (const char *file)
FILE *fp;
int fd;
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
fd = open (file, O_EXCL | O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
{
error (0, errno, "%s", file);