sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-10 13:29:41 +00:00
parent 550dd57439
commit 1216bb5537
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
10 changed files with 42 additions and 39 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.8 2023/10/26 14:27:01 deraadt Exp $
# $OpenBSD: Makefile,v 1.9 2024/02/10 16:47:46 deraadt Exp $
FS= install${OSrev}.img
FSSIZE= 1126400
FSSIZE= 1136400
CDROM= install${OSrev}.iso
MOUNT_POINT= /mnt

View File

@ -1631,7 +1631,8 @@ local block_state deflate_stored(deflate_state *s, int flush) {
* possible. If flushing, copy the remaining available input to next_out as
* stored blocks, if there is enough space.
*/
unsigned len, left, have, last = 0;
int last = 0;
unsigned len, left, have;
unsigned used = s->strm->avail_in;
do {
/* Set len to the maximum size block that we can copy directly with the

View File

@ -20,6 +20,9 @@
#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS)
# define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include <stdio.h>
#include "zlib.h"
@ -40,7 +43,6 @@
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
# include <share.h>
# include <sys/stat.h>
#endif
@ -48,13 +50,6 @@
# define WIDECHAR
#endif
#if defined(_WIN32) || defined(WINAPI_FAMILY)
# define open _open
# define read _read
# define write _write
# define close _close
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif

View File

@ -5,15 +5,17 @@
#include "gzguts.h"
#if defined(_WIN32) && !defined(__BORLANDC__)
#if defined(UNDER_CE)
# define LSEEK _wcelseek
#elif defined(__DJGPP__)
# define LSEEK llseek
#elif defined(_WIN32) && !defined(__BORLANDC__)
# define LSEEK _lseeki64
#else
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
#elif defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define LSEEK lseek64
#else
# define LSEEK lseek
#endif
#endif
#if defined UNDER_CE
@ -52,8 +54,7 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
msgbuf[chars] = 0;
}
z_size_t len;
wcstombs_s(&len, buf, sizeof(buf), msgbuf, chars + 1);
wcstombs(buf, msgbuf, chars + 1); // assumes buf is big enough
LocalFree(msgbuf);
}
else {
@ -180,10 +181,8 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
/* save the path name for error messages */
#ifdef WIDECHAR
if (fd == -2) {
if (wcstombs_s(&len, NULL, 0, path, 0) != 0)
len = 0;
}
if (fd == -2)
len = wcstombs(NULL, path, 0);
else
#endif
len = strlen((const char *)path);
@ -193,18 +192,21 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
return NULL;
}
#ifdef WIDECHAR
if (fd == -2)
if (fd == -2) {
if (len)
wcstombs_s(&len, state->path, len + 1, path, len + 1);
wcstombs(state->path, path, len + 1);
else
*(state->path) = 0;
}
else
#endif
{
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
(void)snprintf(state->path, len + 1, "%s", (const char *)path);
#else
strcpy(state->path, path);
#endif
}
/* compute the flags for open() */
oflag =
@ -232,7 +234,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
state->fd = open((const char *)path, oflag, 0666);
#ifdef WIDECHAR
else if (fd == -2)
_wsopen_s(&state->fd, path, oflag, _SH_DENYNO, _S_IREAD | _S_IWRITE);
state->fd = _wopen(path, oflag, _S_IREAD | _S_IWRITE);
#endif
else
state->fd = fd;

View File

@ -374,7 +374,8 @@ int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
}
/* -- see zlib.h -- */
z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) {
z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
gzFile file) {
z_size_t len;
gz_statep state;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.424 2024/01/19 01:43:27 bluhm Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.425 2024/02/10 15:28:16 deraadt Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -771,14 +771,13 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case HW_ALLOWPOWERDOWN:
return (sysctl_securelevel_int(oldp, oldlenp, newp, newlen,
&allowpowerdown));
#if NUCOM > 0
case HW_UCOMNAMES: {
const char *str = sysctl_ucominit();
if (str == NULL)
return EINVAL;
const char *str = "";
#if NUCOM > 0
str = sysctl_ucominit();
#endif /* NUCOM > 0 */
return (sysctl_rdstring(oldp, oldlenp, newp, str));
}
#endif /* NUCOM > 0 */
#ifdef __HAVE_CPU_TOPOLOGY
case HW_SMT:
return (sysctl_hwsmt(oldp, oldlenp, newp, newlen));

View File

@ -1633,7 +1633,8 @@ local block_state deflate_stored(deflate_state *s, int flush) {
* possible. If flushing, copy the remaining available input to next_out as
* stored blocks, if there is enough space.
*/
unsigned len, left, have, last = 0;
int last = 0;
unsigned len, left, have;
unsigned used = s->strm->avail_in;
do {
/* Set len to the maximum size block that we can copy directly with the

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cu.c,v 1.30 2023/12/21 11:25:38 jca Exp $ */
/* $OpenBSD: cu.c,v 1.31 2024/02/10 15:29:04 deraadt Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
@ -488,13 +488,13 @@ get_ucomnames(void)
size = 0;
for (;;) {
if (sysctl(mib, 2, NULL, &size, NULL, 0) == -1 || size == 0)
err(1, "hw.ucomnames");
return NULL;
if ((names = realloc(names, size)) == NULL)
err(1, NULL);
if (sysctl(mib, 2, names, &size, NULL, 0) != -1)
break;
if (errno != ENOMEM)
err(1, "hw.ucomnames");
return NULL;
}
return names;
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.108 2023/01/18 20:56:36 deraadt Exp $
# $OpenBSD: Makefile,v 1.109 2024/02/10 11:28:52 naddy Exp $
.PATH: ${.CURDIR}/..
@ -50,6 +50,8 @@ DPADD+= ${LIBZ}
# The random relink kit, used on OpenBSD by /etc/rc
CLEANFILES+= Makefile.relink sshd.tar
Makefile.relink: ${.CURDIR}/../Makefile.inc ${.CURDIR}/Makefile
# XXX assume a concatenation of these is OK
cat ${.CURDIR}/../Makefile.inc ${.CURDIR}/Makefile > Makefile.relink

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mmio.c,v 1.2 2022/12/28 21:30:19 jmc Exp $ */
/* $OpenBSD: mmio.c,v 1.3 2024/02/10 12:31:16 dv Exp $ */
/*
* Copyright (c) 2022 Dave Voutila <dv@openbsd.org>
@ -473,7 +473,7 @@ static enum decode_result
decode_modrm(struct x86_decode_state *state, struct x86_insn *insn)
{
enum decode_result res;
uint8_t byte;
uint8_t byte = 0;
if (!is_valid_state(state, __func__) || insn == NULL)
return (DECODE_ERROR);
@ -486,8 +486,10 @@ decode_modrm(struct x86_decode_state *state, struct x86_insn *insn)
case OP_ENC_RM:
case OP_ENC_MI:
res = next_byte(state, &byte);
if (res == DECODE_ERROR)
if (res == DECODE_ERROR) {
log_warnx("%s: failed to get modrm byte", __func__);
break;
}
insn->insn_modrm = byte;
insn->insn_modrm_valid = 1;
break;