-/* $OpenBSD: exec_i386.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.3 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
- fd = open(path, 0);
+ fd = open(path, O_RDONLY);
if (fd == -1)
return;
-/* $OpenBSD: exec_i386.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.3 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
- fd = open(path, 0);
+ fd = open(path, O_RDONLY);
if (fd == -1)
return;
-/* $OpenBSD: exec_i386.c,v 1.6 2021/06/07 00:04:20 krw Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.7 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
- fd = open(path, 0);
+ fd = open(path, O_RDONLY);
if (fd == -1)
return;
-/* $OpenBSD: exec_i386.c,v 1.34 2021/06/05 13:32:52 deraadt Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.35 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
- fd = open(path, 0);
+ fd = open(path, O_RDONLY);
if (fd == -1)
return;
-/* $OpenBSD: exec_i386.c,v 1.50 2019/06/08 02:52:20 jsg Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.51 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
- fd = open(path, 0);
+ fd = open(path, O_RDONLY);
if (fd == -1)
return;
-/* $OpenBSD: boot1.c,v 1.9 2020/12/09 18:10:19 krw Exp $ */
+/* $OpenBSD: boot1.c,v 1.10 2021/10/24 17:49:19 deraadt Exp $ */
/* $NetBSD: boot1.c,v 1.1 2006/09/01 21:26:19 uwe Exp $ */
/*-
bios_sector = ptn_disklabel.d_partitions[0].p_offset;
*sector = bios_sector;
- fd = open("boot", 0);
+ fd = open("boot", O_RDONLY);
} while (0);
if (fd == -1 || fstat(fd, &sb) == -1)
-/* $OpenBSD: boot.c,v 1.36 2021/01/30 21:06:45 deraadt Exp $ */
+/* $OpenBSD: boot.c,v 1.37 2021/10/24 17:49:19 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */
/*
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
rc4_keysetup(&randomctx, rnddata, sizeof rnddata);
rc4_skip(&randomctx, 1536);
- if ((fd = open(bootline, 0)) < 0) {
+ if ((fd = open(bootline, O_RDONLY)) < 0) {
printf("open %s: %s\n", opened_name, strerror(errno));
continue;
}
/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile.c,v 1.20 2019/04/10 04:17:37 deraadt Exp $ */
+/* $OpenBSD: loadfile.c,v 1.21 2021/10/24 17:49:19 deraadt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
int fd, rval;
/* Open the file. */
- if ((fd = open(fname, 0)) < 0) {
+ if ((fd = open(fname, O_RDONLY)) < 0) {
WARN(("open %s", fname ? fname : "<default>"));
return -1;
}
-/* $OpenBSD: stand.h,v 1.70 2020/12/09 18:10:19 krw Exp $ */
+/* $OpenBSD: stand.h,v 1.71 2021/10/24 17:49:19 deraadt Exp $ */
/* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */
/*-
char *strchr(const char *, int);
void *memset(void *, int, size_t);
void exit(void);
+#define O_RDONLY 0x0000 /* open for reading only */
+#define O_WRONLY 0x0001 /* open for writing only */
+#define O_RDWR 0x0002 /* open for reading and writing */
int open(const char *, int);
int close(int);
void closeall(void);
-/* $OpenBSD: stat.c,v 1.6 2003/08/11 06:23:09 deraadt Exp $ */
+/* $OpenBSD: stat.c,v 1.7 2021/10/24 17:49:19 deraadt Exp $ */
/* $NetBSD: stat.c,v 1.3 1994/10/26 05:45:07 cgd Exp $ */
/*-
#ifdef __INTERNAL_LIBSA_CREAD
if ((fd = oopen(str, 0)) < 0)
#else
- if ((fd = open(str, 0)) < 0)
+ if ((fd = open(str, O_RDONLY)) < 0)
#endif
return (-1);
rv = fstat(fd, sb);
-/* $OpenBSD: boot.c,v 1.54 2020/06/15 14:43:57 naddy Exp $ */
+/* $OpenBSD: boot.c,v 1.55 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 2003 Dale Rahn
struct stat sb;
int fd, i, error = 0;
-#define O_RDONLY 0
-
/* Extract the device name from the kernel we are loading. */
for (i = 0; i < sizeof(cmd.path); i++) {
if (cmd.path[i] == ':') {
-/* $OpenBSD: cmd.c,v 1.67 2019/12/02 01:38:06 deraadt Exp $ */
+/* $OpenBSD: cmd.c,v 1.68 2021/10/24 17:49:19 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
}
#endif
- if ((fd = open(qualify(cmd.conf), 0)) < 0) {
+ if ((fd = open(qualify(cmd.conf), O_RDONLY)) < 0) {
if (errno != ENOENT && errno != ENXIO) {
printf("open(%s): %s\n", cmd.path, strerror(errno));
return 0;