From f1ec001029402476abce34e4130373b3c34a16c7 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 3 Feb 2008 03:49:15 +0000 Subject: Use mkstemp to make the temporary files used when you win. --- larn/bill.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/larn/bill.c b/larn/bill.c index 0006482f..0740558c 100644 --- a/larn/bill.c +++ b/larn/bill.c @@ -1,4 +1,4 @@ -/* $NetBSD: bill.c,v 1.8 2008/01/28 05:38:53 dholland Exp $ */ +/* $NetBSD: bill.c,v 1.9 2008/02/03 03:49:15 dholland Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)bill.c 5.2 (Berkeley) 5/28/91"; #else -__RCSID("$NetBSD: bill.c,v 1.8 2008/01/28 05:38:53 dholland Exp $"); +__RCSID("$NetBSD: bill.c,v 1.9 2008/02/03 03:49:15 dholland Exp $"); #endif #endif /* not lint */ @@ -44,6 +44,7 @@ __RCSID("$NetBSD: bill.c,v 1.8 2008/01/28 05:38:53 dholland Exp $"); #include #include #include +#include #include "header.h" #include "extern.h" @@ -130,10 +131,9 @@ mailbill() if (fork() == 0) { resetscroll(); cp = mail; - snprintf(fname, sizeof(fname), "/tmp/#%dlarnmail", getpid()); + snprintf(fname, sizeof(fname), "%slarnmail.XXXXXX", _PATH_TMP); for (i = 0; i < 6; i++) { - if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, - 0666)) == -1) + if ((fd = mkstemp(fname)) == -1) exit(0); while (*cp != NULL) { if (*cp[0] == '1') { -- cgit v1.2.3-56-ge451