summaryrefslogtreecommitdiff
path: root/games/hack
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-11 01:12:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-11 01:12:11 +0000
commitdf8ebf4c4a153005ea56888d82e05288c597b4dc (patch)
treec0eb870a47c4f73e3880ed05eb2ca1d61294ea89 /games/hack
parent4a35cd787d4211704bc33e641f746562a95af113 (diff)
creat() -> open equiv; from Frederic Nowak
Diffstat (limited to 'games/hack')
-rw-r--r--games/hack/hack.bones.c4
-rw-r--r--games/hack/hack.do.c4
-rw-r--r--games/hack/hack.save.c6
-rw-r--r--games/hack/hack.unix.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/games/hack/hack.bones.c b/games/hack/hack.bones.c
index 6cd76829f1b..9c93b813ab7 100644
--- a/games/hack/hack.bones.c
+++ b/games/hack/hack.bones.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.bones.c,v 1.8 2009/10/27 23:59:25 deraadt Exp $ */
+/* $OpenBSD: hack.bones.c,v 1.9 2015/11/11 01:12:10 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -129,7 +129,7 @@ savebones()
otmp->cursed = 1; /* flag as gotten from a ghost */
}
}
- if((fd = creat(bones, FMASK)) < 0) return;
+ if((fd = open(bones, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) < 0) return;
savelev(fd,dlevel);
(void) close(fd);
}
diff --git a/games/hack/hack.do.c b/games/hack/hack.do.c
index e74f0747bc9..8b2457cd8b1 100644
--- a/games/hack/hack.do.c
+++ b/games/hack/hack.do.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.do.c,v 1.8 2014/03/11 08:05:15 guenther Exp $ */
+/* $OpenBSD: hack.do.c,v 1.9 2015/11/11 01:12:10 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -193,7 +193,7 @@ goto_level(int newlevel, boolean at_stairs)
if(newlevel == dlevel) return; /* this can happen */
glo(dlevel);
- fd = creat(lock, FMASK);
+ fd = open(lock, O_CREAT | O_TRUNC | O_WRONLY, FMASK);
if(fd < 0) {
/*
* This is not quite impossible: e.g., we may have
diff --git a/games/hack/hack.save.c b/games/hack/hack.save.c
index e31b2b2d1f4..481cecede80 100644
--- a/games/hack/hack.save.c
+++ b/games/hack/hack.save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.save.c,v 1.11 2014/03/11 08:05:15 guenther Exp $ */
+/* $OpenBSD: hack.save.c,v 1.12 2015/11/11 01:12:10 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -100,7 +100,7 @@ dosave0(int hu)
(void) signal(SIGHUP, SIG_IGN);
(void) signal(SIGINT, SIG_IGN);
- if((fd = creat(SAVEF, FMASK)) < 0) {
+ if((fd = open(SAVEF, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) < 0) {
if(!hu) pline("Cannot open save file. (Continue or Quit)");
(void) unlink(SAVEF); /* ab@unido */
return(0);
@@ -192,7 +192,7 @@ dorecover(int fd)
break;
getlev(fd, 0, tmp);
glo(tmp);
- if((nfd = creat(lock, FMASK)) < 0)
+ if((nfd = open(lock, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) < 0)
panic("Cannot open temp file %s!\n", lock);
savelev(nfd,tmp);
(void) close(nfd);
diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c
index 18502de172c..f0eef097307 100644
--- a/games/hack/hack.unix.c
+++ b/games/hack/hack.unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.unix.c,v 1.15 2014/11/16 04:49:48 guenther Exp $ */
+/* $OpenBSD: hack.unix.c,v 1.16 2015/11/11 01:12:10 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -286,7 +286,7 @@ getlock()
error(locknum ? "Too many hacks running now."
: "There is a game in progress under your name.");
gotlock:
- fd = creat(lock, FMASK);
+ fd = open(lock, O_CREAT | O_TRUNC | O_WRONLY, FMASK);
if(unlink(LLOCK) == -1)
error("Cannot unlink %s.", LLOCK);
if(fd == -1) {