diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-08-16 17:00:18 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-08-16 17:00:18 +0000 |
commit | f614ad9ddbe518d66af1d345c18ac6c1d4b3ec72 (patch) | |
tree | 6f9ff210ef26a86ab8a226b9f1192c11e01eb114 /games | |
parent | 7f4a7535eb888a8b95b0a6c252954d2464a59753 (diff) |
use O_* defines for open(2) flags and include fcntl.h
Diffstat (limited to 'games')
-rw-r--r-- | games/dm/dm.c | 8 | ||||
-rw-r--r-- | games/hack/hack.bones.c | 4 | ||||
-rw-r--r-- | games/hack/hack.do.c | 2 | ||||
-rw-r--r-- | games/hack/hack.h | 1 | ||||
-rw-r--r-- | games/hack/hack.main.c | 4 | ||||
-rw-r--r-- | games/hack/hack.pager.c | 2 | ||||
-rw-r--r-- | games/hack/hack.save.c | 2 | ||||
-rw-r--r-- | games/hack/hack.unix.c | 2 | ||||
-rw-r--r-- | games/hack/makedefs.c | 4 |
9 files changed, 16 insertions, 13 deletions
diff --git a/games/dm/dm.c b/games/dm/dm.c index c19944bdd60..fa5362a454a 100644 --- a/games/dm/dm.c +++ b/games/dm/dm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dm.c,v 1.11 1999/07/31 18:48:52 pjanzen Exp $ */ +/* $OpenBSD: dm.c,v 1.12 1999/08/16 17:00:14 millert Exp $ */ /* $NetBSD: dm.c,v 1.5 1996/02/06 22:47:20 jtc Exp $ */ /* @@ -44,18 +44,18 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: dm.c,v 1.11 1999/07/31 18:48:52 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: dm.c,v 1.12 1999/08/16 17:00:14 millert Exp $"; #endif #endif /* not lint */ #include <sys/param.h> -#include <sys/file.h> #include <sys/time.h> #include <sys/resource.h> -#include <err.h> #include <ctype.h> +#include <err.h> #include <errno.h> +#include <fcntl.h> #include <nlist.h> #include <pwd.h> #include <stdio.h> diff --git a/games/hack/hack.bones.c b/games/hack/hack.bones.c index b495294c94b..0685a3faa82 100644 --- a/games/hack/hack.bones.c +++ b/games/hack/hack.bones.c @@ -24,7 +24,7 @@ register struct monst *mtmp; if(!rn2(1 + dlevel/2)) return; /* not so many ghosts on low levels */ bones[6] = '0' + (dlevel/10); bones[7] = '0' + (dlevel%10); - if((fd = open(bones,0)) >= 0){ + if((fd = open(bones, O_RDONLY)) >= 0){ (void) close(fd); return; } @@ -82,7 +82,7 @@ register fd,x,y,ok; if(rn2(3)) return(0); /* only once in three times do we find bones */ bones[6] = '0' + dlevel/10; bones[7] = '0' + dlevel%10; - if((fd = open(bones, 0)) < 0) return(0); + if((fd = open(bones, O_RDONLY)) < 0) return(0); if((ok = uptodate(fd)) != 0){ getlev(fd, 0, dlevel); for(x = 0; x < COLNO; x++) for(y = 0; y < ROWNO; y++) diff --git a/games/hack/hack.do.c b/games/hack/hack.do.c index aec8b91176b..2d21adadd2b 100644 --- a/games/hack/hack.do.c +++ b/games/hack/hack.do.c @@ -171,7 +171,7 @@ register boolean at_stairs; else { extern int hackpid; - if((fd = open(lock,0)) < 0) { + if((fd = open(lock, O_RDONLY)) < 0) { pline("Cannot open %s .", lock); pline("Probably someone removed it."); done("tricked"); diff --git a/games/hack/hack.h b/games/hack/hack.h index 94d1278ff19..3dc49fdf5c5 100644 --- a/games/hack/hack.h +++ b/games/hack/hack.h @@ -6,6 +6,7 @@ #include "config.h" #include <string.h> +#include <fcntl.h> #define Null(type) ((struct type *) 0) diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c index 4b2e06fe654..73303fa6263 100644 --- a/games/hack/hack.main.c +++ b/games/hack/hack.main.c @@ -251,7 +251,7 @@ char *argv[]; setftty(); (void) sprintf(SAVEF, "save/%d%s", getuid(), plname); regularize(SAVEF+5); /* avoid . or / in name */ - if((fd = open(SAVEF,0)) >= 0 && + if((fd = open(SAVEF, O_RDONLY)) >= 0 && (uptodate(fd) || unlink(SAVEF) == 666)) { (void) signal(SIGINT,done1); pline("Restoring old save file..."); @@ -493,7 +493,7 @@ boolean wr; if(dir == NULL) dir = "."; - if((fd = open(RECORD, 2)) < 0) { + if((fd = open(RECORD, O_RDWR)) < 0) { printf("Warning: cannot write %s/%s", dir, RECORD); getret(); } else diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c index 13382aceda4..c07881bfbc4 100644 --- a/games/hack/hack.pager.c +++ b/games/hack/hack.pager.c @@ -301,7 +301,7 @@ boolean silent; { /* use external pager; this may give security problems */ - register int fd = open(fnam, 0); + register int fd = open(fnam, O_RDONLY); if(fd < 0) { if(!silent) pline("Cannot open %s.", fnam); diff --git a/games/hack/hack.save.c b/games/hack/hack.save.c index 3e7a2543c4d..e2802a009b6 100644 --- a/games/hack/hack.save.c +++ b/games/hack/hack.save.c @@ -71,7 +71,7 @@ dosave0(hu) int hu; { if(tmp == dlevel || !level_exists[tmp]) continue; glo(tmp); - if((ofd = open(lock, 0)) < 0) { + if((ofd = open(lock, O_RDONLY)) < 0) { if(!hu) pline("Error while saving: cannot read %s.", lock); (void) close(fd); (void) unlink(SAVEF); diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c index 15a50c46a0a..37fe9d9d599 100644 --- a/games/hack/hack.unix.c +++ b/games/hack/hack.unix.c @@ -217,7 +217,7 @@ getlock() do { if(locknum) lock[0] = 'a' + i++; - if((fd = open(lock, 0)) == -1) { + if((fd = open(lock, O_RDONLY)) == -1) { if(errno == ENOENT) goto gotlock; /* no such file */ perror(lock); (void) unlink(LLOCK); diff --git a/games/hack/makedefs.c b/games/hack/makedefs.c index e0567032b1f..1403e284a76 100644 --- a/games/hack/makedefs.c +++ b/games/hack/makedefs.c @@ -8,6 +8,7 @@ static char rcsid[] = "$NetBSD: makedefs.c,v 1.4 1995/04/24 12:23:39 cgd Exp $"; #include <stdio.h> #include <string.h> +#include <fcntl.h> /* construct definitions of object constants */ #define LINSZ 1000 @@ -16,6 +17,7 @@ static char rcsid[] = "$NetBSD: makedefs.c,v 1.4 1995/04/24 12:23:39 cgd Exp $"; int fd; char string[STRSZ]; +int main(argc, argv) int argc; char **argv; @@ -27,7 +29,7 @@ register char *sp; (void)fprintf(stderr, "usage: makedefs file\n"); exit(1); } - if ((fd = open(argv[1], 0)) < 0) { + if ((fd = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); exit(1); } |