[openssh-commits] [openssh] 01/01: remove sys/param.h in -portable, after upstream

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Dec 22 09:03:21 AEDT 2021


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 715c892f0a5295b391ae92c26ef4d6a86ea96e8e
Author: Damien Miller <djm at mindrot.org>
Date:   Wed Dec 22 09:02:50 2021 +1100

    remove sys/param.h in -portable, after upstream
---
 atomicio.c                                  | 1 -
 channels.c                                  | 2 +-
 includes.h                                  | 1 -
 loginrec.c                                  | 3 ++-
 openbsd-compat/arc4random.c                 | 8 +++++---
 openbsd-compat/base64.c                     | 1 -
 openbsd-compat/bcrypt_pbkdf.c               | 1 -
 openbsd-compat/bsd-closefrom.c              | 1 -
 openbsd-compat/bsd-statvfs.c                | 1 -
 openbsd-compat/dirname.c                    | 1 -
 openbsd-compat/getcwd.c                     | 1 -
 openbsd-compat/inet_aton.c                  | 1 -
 openbsd-compat/inet_ntop.c                  | 1 -
 openbsd-compat/port-solaris.c               | 1 -
 openbsd-compat/xcrypt.c                     | 4 +++-
 regress/misc/fuzz-harness/kex_fuzz.cc       | 1 -
 regress/unittests/sshbuf/test_sshbuf.c      | 2 ++
 regress/unittests/test_helper/test_helper.c | 1 -
 sandbox-capsicum.c                          | 1 -
 session.c                                   | 1 -
 sftp.c                                      | 1 -
 ssh-agent.c                                 | 1 -
 22 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/atomicio.c b/atomicio.c
index e00c9f0d..76507335 100644
--- a/atomicio.c
+++ b/atomicio.c
@@ -28,7 +28,6 @@
 
 #include "includes.h"
 
-#include <sys/param.h>
 #include <sys/uio.h>
 
 #include <errno.h>
diff --git a/channels.c b/channels.c
index 1c714c84..3368098e 100644
--- a/channels.c
+++ b/channels.c
@@ -2027,7 +2027,7 @@ channel_handle_wfd(struct ssh *ssh, Channel *c,
 #ifdef _AIX
 	/* XXX: Later AIX versions can't push as much data to tty */
 	if (c->wfd_isatty)
-		dlen = MIN(dlen, 8*1024);
+		dlen = MINIMUM(dlen, 8*1024);
 #endif
 
 	len = write(c->wfd, buf, dlen);
diff --git a/includes.h b/includes.h
index 0fd71792..6d17ef6d 100644
--- a/includes.h
+++ b/includes.h
@@ -23,7 +23,6 @@
 #endif
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <sys/socket.h> /* For CMSG_* */
 
 #ifdef HAVE_LIMITS_H
diff --git a/loginrec.c b/loginrec.c
index ea058fd6..4f214995 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -181,6 +181,7 @@
 #include "auth.h"
 #include "sshbuf.h"
 #include "ssherr.h"
+#include "misc.h"
 
 #ifdef HAVE_UTIL_H
 # include <util.h>
@@ -801,7 +802,7 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
 # endif
 # ifdef HAVE_SYSLEN_IN_UTMPX
 	/* ut_syslen is the length of the utx_host string */
-	utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host));
+	utx->ut_syslen = MINIMUM(strlen(li->hostname), sizeof(utx->ut_host));
 # endif
 }
 #endif /* USE_UTMPX || USE_WTMPX */
diff --git a/openbsd-compat/arc4random.c b/openbsd-compat/arc4random.c
index 14853aba..80ff3c18 100644
--- a/openbsd-compat/arc4random.c
+++ b/openbsd-compat/arc4random.c
@@ -39,6 +39,8 @@
 
 #ifndef HAVE_ARC4RANDOM
 
+#define MINIMUM(a, b)    (((a) < (b)) ? (a) : (b))
+
 #ifdef WITH_OPENSSL
 #include <openssl/rand.h>
 #include <openssl/err.h>
@@ -170,7 +172,7 @@ _rs_rekey(u_char *dat, size_t datlen)
 	if (dat) {
 		size_t i, m;
 
-		m = MIN(datlen, KEYSZ + IVSZ);
+		m = MINIMUM(datlen, KEYSZ + IVSZ);
 		for (i = 0; i < m; i++)
 			rs_buf[i] ^= dat[i];
 	}
@@ -189,7 +191,7 @@ _rs_random_buf(void *_buf, size_t n)
 	_rs_stir_if_needed(n);
 	while (n > 0) {
 		if (rs_have > 0) {
-			m = MIN(n, rs_have);
+			m = MINIMUM(n, rs_have);
 			memcpy(buf, rs_buf + RSBUFSZ - rs_have, m);
 			memset(rs_buf + RSBUFSZ - rs_have, 0, m);
 			buf += m;
@@ -230,7 +232,7 @@ arc4random_addrandom(u_char *dat, int datlen)
 	if (!rs_initialized)
 		_rs_stir();
 	while (datlen > 0) {
-		m = MIN(datlen, KEYSZ + IVSZ);
+		m = MINIMUM(datlen, KEYSZ + IVSZ);
 		_rs_rekey(dat, m);
 		dat += m;
 		datlen -= m;
diff --git a/openbsd-compat/base64.c b/openbsd-compat/base64.c
index b7dce095..e5faba3c 100644
--- a/openbsd-compat/base64.c
+++ b/openbsd-compat/base64.c
@@ -49,7 +49,6 @@
 #if (!defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)) || (!defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON))
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
diff --git a/openbsd-compat/bcrypt_pbkdf.c b/openbsd-compat/bcrypt_pbkdf.c
index 95b150f8..5a22ba3b 100644
--- a/openbsd-compat/bcrypt_pbkdf.c
+++ b/openbsd-compat/bcrypt_pbkdf.c
@@ -24,7 +24,6 @@
 #ifndef HAVE_BCRYPT_PBKDF
 
 #include <sys/types.h>
-#include <sys/param.h>
 
 #ifdef HAVE_STDLIB_H
 # include <stdlib.h>
diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c
index 08b7da69..704da531 100644
--- a/openbsd-compat/bsd-closefrom.c
+++ b/openbsd-compat/bsd-closefrom.c
@@ -19,7 +19,6 @@
 #if !defined(HAVE_CLOSEFROM) || defined(BROKEN_CLOSEFROM)
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <unistd.h>
 #include <stdio.h>
 #ifdef HAVE_FCNTL_H
diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c
index 10d87643..18ca726c 100644
--- a/openbsd-compat/bsd-statvfs.c
+++ b/openbsd-compat/bsd-statvfs.c
@@ -18,7 +18,6 @@
 
 #if !defined(HAVE_STATVFS) || !defined(HAVE_FSTATVFS)
 
-#include <sys/param.h>
 #ifdef HAVE_SYS_MOUNT_H
 # include <sys/mount.h>
 #endif
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c
index 30fcb496..127bc2ae 100644
--- a/openbsd-compat/dirname.c
+++ b/openbsd-compat/dirname.c
@@ -23,7 +23,6 @@
 
 #include <errno.h>
 #include <string.h>
-#include <sys/param.h>
 
 char *
 dirname(const char *path)
diff --git a/openbsd-compat/getcwd.c b/openbsd-compat/getcwd.c
index e4f7f5a3..2d56bae1 100644
--- a/openbsd-compat/getcwd.c
+++ b/openbsd-compat/getcwd.c
@@ -34,7 +34,6 @@
 
 #if !defined(HAVE_GETCWD)
 
-#include <sys/param.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <dirent.h>
diff --git a/openbsd-compat/inet_aton.c b/openbsd-compat/inet_aton.c
index 093a1720..5efcc5f0 100644
--- a/openbsd-compat/inet_aton.c
+++ b/openbsd-compat/inet_aton.c
@@ -56,7 +56,6 @@
 #if !defined(HAVE_INET_ATON)
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <ctype.h>
diff --git a/openbsd-compat/inet_ntop.c b/openbsd-compat/inet_ntop.c
index 3259037b..c037f080 100644
--- a/openbsd-compat/inet_ntop.c
+++ b/openbsd-compat/inet_ntop.c
@@ -22,7 +22,6 @@
 
 #ifndef HAVE_INET_NTOP
 
-#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
diff --git a/openbsd-compat/port-solaris.c b/openbsd-compat/port-solaris.c
index b84fbff5..10c2d6b7 100644
--- a/openbsd-compat/port-solaris.c
+++ b/openbsd-compat/port-solaris.c
@@ -19,7 +19,6 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 
 #include <errno.h>
 #ifdef HAVE_FCNTL_H
diff --git a/openbsd-compat/xcrypt.c b/openbsd-compat/xcrypt.c
index e493dd31..9cded668 100644
--- a/openbsd-compat/xcrypt.c
+++ b/openbsd-compat/xcrypt.c
@@ -59,6 +59,8 @@
 #  define crypt DES_crypt
 # endif
 
+#define MINIMUM(a, b)	(((a) < (b)) ? (a) : (b))
+
 /*
  * Pick an appropriate password encryption type and salt for the running
  * system by searching through accounts until we find one that has a valid
@@ -82,7 +84,7 @@ pick_salt(void)
 			continue;
 		if (passwd[0] == '$' && (p = strrchr(passwd+1, '$')) != NULL) {
 			typelen = p - passwd + 1;
-			strlcpy(salt, passwd, MIN(typelen, sizeof(salt)));
+			strlcpy(salt, passwd, MINIMUM(typelen, sizeof(salt)));
 			explicit_bzero(passwd, strlen(passwd));
 			goto out;
 		}
diff --git a/regress/misc/fuzz-harness/kex_fuzz.cc b/regress/misc/fuzz-harness/kex_fuzz.cc
index 4740a7cb..fc145d48 100644
--- a/regress/misc/fuzz-harness/kex_fuzz.cc
+++ b/regress/misc/fuzz-harness/kex_fuzz.cc
@@ -2,7 +2,6 @@
 
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf.c b/regress/unittests/sshbuf/test_sshbuf.c
index 052d4f2b..e22b390f 100644
--- a/regress/unittests/sshbuf/test_sshbuf.c
+++ b/regress/unittests/sshbuf/test_sshbuf.c
@@ -23,7 +23,9 @@
 
 void sshbuf_tests(void);
 
+#ifndef roundup
 #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
+#endif
 
 void
 sshbuf_tests(void)
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index de125fcd..6461d7ff 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -20,7 +20,6 @@
 #include "includes.h"
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <sys/uio.h>
 
 #include <stdarg.h>
diff --git a/sandbox-capsicum.c b/sandbox-capsicum.c
index e10bad7e..883be185 100644
--- a/sandbox-capsicum.c
+++ b/sandbox-capsicum.c
@@ -19,7 +19,6 @@
 #ifdef SANDBOX_CAPSICUM
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/capsicum.h>
diff --git a/session.c b/session.c
index 5f423f9f..fb2d7009 100644
--- a/session.c
+++ b/session.c
@@ -36,7 +36,6 @@
 #include "includes.h"
 
 #include <sys/types.h>
-#include <sys/param.h>
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
diff --git a/sftp.c b/sftp.c
index 418f312f..8cb5917a 100644
--- a/sftp.c
+++ b/sftp.c
@@ -22,7 +22,6 @@
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
 #ifdef HAVE_SYS_STATVFS_H
diff --git a/ssh-agent.c b/ssh-agent.c
index 390d8aa1..f7d3390d 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -37,7 +37,6 @@
 #include "includes.h"
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/socket.h>

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list