say goodbye to creat().

From: Marc Espie <espie@cvs.openbsd.org>
This commit is contained in:
tg 2005-08-02 12:26:17 +00:00
parent 35f1a9b29f
commit 1197e6fd1b

View File

@ -1,5 +1,5 @@
/** $MirOS: src/bin/mksh/histrap.c,v 1.10 2005/07/07 23:27:52 tg Exp $ */
/* $OpenBSD: history.c,v 1.30 2005/03/30 17:16:37 deraadt Exp $ */
/** $MirOS: src/bin/mksh/histrap.c,v 1.11 2005/08/02 12:26:17 tg Exp $ */
/* $OpenBSD: history.c,v 1.31 2005/07/31 16:12:52 espie Exp $ */
/* $OpenBSD: trap.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
#include "sh.h"
@ -7,7 +7,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.10 2005/07/07 23:27:52 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.11 2005/08/02 12:26:17 tg Exp $");
static int histfd;
static int hsize;
@ -773,7 +773,7 @@ hist_shrink(unsigned char *oldbase, int oldbytes)
* create temp file
*/
(void) shf_snprintf(nfile, sizeof(nfile), "%s.%d", hname, procpid);
if ((fd = creat(nfile, 0600)) < 0)
if ((fd = open(nfile, O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0)
return 1;
if (sprinkle(fd)) {