summaryrefslogtreecommitdiffstats
path: root/larn
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2008-02-03 03:49:15 +0000
committerdholland <dholland@NetBSD.org>2008-02-03 03:49:15 +0000
commitf1ec001029402476abce34e4130373b3c34a16c7 (patch)
treed1e6f3c158827c332f8ecca0edec9c441949281a /larn
parentba1922e360028e00b0ecadd02bb51f723c22ce67 (diff)
downloadbsdgames-darwin-f1ec001029402476abce34e4130373b3c34a16c7.tar.gz
bsdgames-darwin-f1ec001029402476abce34e4130373b3c34a16c7.tar.zst
bsdgames-darwin-f1ec001029402476abce34e4130373b3c34a16c7.zip
Use mkstemp to make the temporary files used when you win.
Diffstat (limited to 'larn')
-rw-r--r--larn/bill.c10
1 files 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 <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <paths.h>
#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') {