mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
creat() -> open equiv; from Frederic Nowak
This commit is contained in:
parent
d04ba2cc13
commit
f24baa2d48
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: save.c,v 1.12 2015/06/26 19:18:03 otto Exp $ */
|
||||
/* $OpenBSD: save.c,v 1.13 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -86,7 +86,9 @@ save(n)
|
||||
}
|
||||
*fs = '\0';
|
||||
if ((fdesc = open(fname, O_RDWR)) == -1 && errno == ENOENT) {
|
||||
if ((fdesc = creat(fname, 0600)) != -1)
|
||||
if ((fdesc = open(fname,
|
||||
O_CREAT | O_TRUNC | O_WRONLY,
|
||||
0600)) != -1)
|
||||
break;
|
||||
}
|
||||
if (fdesc != -1) {
|
||||
@ -97,7 +99,9 @@ save(n)
|
||||
close(fdesc);
|
||||
if (yorn(0)) {
|
||||
unlink(fname);
|
||||
fdesc = creat(fname, 0600);
|
||||
fdesc = open(fname,
|
||||
O_CREAT | O_TRUNC | O_WRONLY,
|
||||
0600);
|
||||
break;
|
||||
} else {
|
||||
cflag = 1;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: save.c,v 1.8 2009/10/27 23:59:26 deraadt Exp $ */
|
||||
/* $OpenBSD: save.c,v 1.9 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
/* $NetBSD: save.c,v 1.4 1995/03/24 05:02:13 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -100,7 +100,7 @@ over:
|
||||
&& getyn(OVERWRITEFILEPROMPT) == FALSE))
|
||||
return FALSE;
|
||||
|
||||
if ((outf = creat(buf, 0644)) < 0) {
|
||||
if ((outf = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0644)) < 0) {
|
||||
error(strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dumpgame.c,v 1.9 2009/10/27 23:59:27 deraadt Exp $ */
|
||||
/* $OpenBSD: dumpgame.c,v 1.10 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
/* $NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -81,7 +81,7 @@ dumpgame(v)
|
||||
struct dump *d;
|
||||
int i;
|
||||
|
||||
if ((fd = creat("trek.dump", 0644)) < 0)
|
||||
if ((fd = open("trek.dump", O_CREAT | O_TRUNC | O_WRONLY, 0644)) < 0)
|
||||
{
|
||||
warn("cannot open `trek.dump'");
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uucplock.c,v 1.16 2009/10/27 23:59:30 deraadt Exp $ */
|
||||
/* $OpenBSD: uucplock.c,v 1.17 2015/11/11 01:12:09 deraadt Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -70,7 +70,7 @@ uu_lock(const char *ttyname)
|
||||
(long)pid);
|
||||
(void)snprintf(lckname, sizeof(lckname), _PATH_UUCPLOCK LOCKFMT,
|
||||
ttyname);
|
||||
if ((tmpfd = creat(lcktmpname, 0664)) < 0)
|
||||
if ((tmpfd = open(lcktmpname, O_CREAT | O_TRUNC | O_WRONLY, 0664)) < 0)
|
||||
GORET(0, UU_LOCK_CREAT_ERR);
|
||||
|
||||
for (i = 0; i < MAXTRIES; i++) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: indent.c,v 1.29 2015/10/09 01:37:07 deraadt Exp $ */
|
||||
/* $OpenBSD: indent.c,v 1.30 2015/11/11 01:12:09 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -1184,7 +1184,7 @@ bakcopy(void)
|
||||
errc(1, ENAMETOOLONG, "%s.BAK", p);
|
||||
|
||||
/* copy in_name to backup file */
|
||||
bakchn = creat(bakfile, 0600);
|
||||
bakchn = open(bakfile, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
||||
if (bakchn < 0)
|
||||
err(1, "%s", bakfile);
|
||||
while ((n = read(fileno(input), buff, sizeof buff)) > 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: quit.c,v 1.21 2014/11/24 20:01:43 millert Exp $ */
|
||||
/* $OpenBSD: quit.c,v 1.22 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
/* $NetBSD: quit.c,v 1.6 1996/12/28 07:11:07 tls Exp $ */
|
||||
|
||||
/*
|
||||
@ -220,7 +220,7 @@ quit(void)
|
||||
return(-1);
|
||||
}
|
||||
(void)Fclose(obuf);
|
||||
(void)close(creat(mbox, 0600));
|
||||
(void)close(open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600));
|
||||
if ((obuf = Fopen(mbox, "r+")) == NULL) {
|
||||
warn("%s", mbox);
|
||||
(void)Fclose(ibuf);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: v7.local.c,v 1.15 2009/10/27 23:59:40 deraadt Exp $ */
|
||||
/* $OpenBSD: v7.local.c,v 1.16 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
/* $NetBSD: v7.local.c,v 1.8 1997/05/13 06:15:58 mikel Exp $ */
|
||||
|
||||
/*
|
||||
@ -72,7 +72,7 @@ demail(void)
|
||||
{
|
||||
|
||||
if (value("keep") != NULL || rm(mailname) < 0)
|
||||
(void)close(creat(mailname, 0600));
|
||||
(void)close(open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: inp.c,v 1.44 2015/07/26 14:32:19 millert Exp $ */
|
||||
/* $OpenBSD: inp.c,v 1.45 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* patch - a program to apply diffs to original files
|
||||
@ -159,7 +159,7 @@ plan_a(const char *filename)
|
||||
if (check_only)
|
||||
return true;
|
||||
makedirs(filename, true);
|
||||
close(creat(filename, 0666));
|
||||
close(open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0666));
|
||||
statfailed = stat(filename, &filestat);
|
||||
}
|
||||
if (statfailed)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.38 2015/10/18 03:54:22 deraadt Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.39 2015/11/11 01:12:10 deraadt Exp $ */
|
||||
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
@ -473,7 +473,7 @@ get(int argc, char *argv[])
|
||||
}
|
||||
if (argc < 4) {
|
||||
cp = argc == 3 ? argv[2] : tail(src);
|
||||
fd = creat(cp, 0644);
|
||||
fd = open(cp, O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
||||
if (fd < 0) {
|
||||
warn("create: %s", cp);
|
||||
return;
|
||||
@ -485,7 +485,7 @@ get(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
cp = tail(src); /* new .. jdg */
|
||||
fd = creat(cp, 0644);
|
||||
fd = open(cp, O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
||||
if (fd < 0) {
|
||||
warn("create: %s", cp);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user