From: Tobias Heider Date: Wed, 19 Jul 2023 12:29:48 +0000 (+0200) Subject: compat sync (#226) X-Git-Tag: v10.0.2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca67bd26f5e7d5c3658774956a98e13ea2df46ee;p=thirdparty%2Fdhcpcd.git compat sync (#226) * compat: sync pidfile.c with netbsd v1.16 - fix typos in word "otherwise". - s/sucess/success/ in comment. * compat: sync rb.c with netbsd v1.16 - fix typos in word "successfully", mainly s/succesfully/successfully/. - toolify * compat: sync strlcpy.c with openbsd v1.16 - I am retiring my old email address; replace it with my OpenBSD one. * compat: sync arc4random_uniform.c with openbsd v1.3 --- diff --git a/compat/arc4random_uniform.c b/compat/arc4random_uniform.c index 0f1b7b29..45117229 100644 --- a/compat/arc4random_uniform.c +++ b/compat/arc4random_uniform.c @@ -1,3 +1,5 @@ +/* $OpenBSD: arc4random_uniform.c,v 1.3 2019/01/20 02:59:07 bcook Exp $ */ + /* * Copyright (c) 2008, Damien Miller * @@ -48,9 +50,11 @@ arc4random_uniform(uint32_t upper_bound) * number inside the range we need, so it should rarely need * to re-roll. */ - do + for (;;) { r = arc4random(); - while (r < min); + if (r >= min) + break; + } return r % upper_bound; } diff --git a/compat/pidfile.c b/compat/pidfile.c index 9dfd9c46..8d2e5a83 100644 --- a/compat/pidfile.c +++ b/compat/pidfile.c @@ -1,4 +1,4 @@ -/* $NetBSD: pidfile.c,v 1.14 2016/04/12 20:40:43 roy Exp $ */ +/* $NetBSD: pidfile.c,v 1.16 2021/08/01 15:29:29 andvar Exp $ */ /*- * Copyright (c) 1999, 2016 The NetBSD Foundation, Inc. @@ -131,7 +131,7 @@ pidfile_varrun_path(char *path, size_t len, const char *bname) } /* Returns the process ID inside path on success, otherwise -1. - * If no path is given, use the last pidfile path, othewise the default one. */ + * If no path is given, use the last pidfile path, otherwise the default one. */ pid_t pidfile_read(const char *path) { @@ -239,7 +239,7 @@ return_pid: if (errno == EAGAIN) { /* The pidfile is locked, return the process ID * it contains. - * If sucessful, set errno to EEXIST. */ + * If successful, set errno to EEXIST. */ if ((pid = pidfile_read(path)) != -1) errno = EEXIST; } else diff --git a/compat/rb.c b/compat/rb.c index 3c0bed5f..4dfbd0d2 100644 --- a/compat/rb.c +++ b/compat/rb.c @@ -1,4 +1,4 @@ -/* $NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $ */ +/* $NetBSD: rb.c,v 1.16 2021/09/16 21:29:41 andvar Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -32,6 +32,10 @@ #include "config.h" #include "common.h" +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + #if !defined(_KERNEL) && !defined(_STANDALONE) #include #include @@ -44,10 +48,10 @@ #define KASSERT(s) do { } while (/*CONSTCOND*/ 0) #define __rbt_unused __unused #endif -__RCSID("$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $"); +__RCSID("$NetBSD: rb.c,v 1.16 2021/09/16 21:29:41 andvar Exp $"); #else #include -__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.16 2021/09/16 21:29:41 andvar Exp $"); #ifndef DIAGNOSTIC #define __rbt_unused __unused #else @@ -312,7 +316,7 @@ rb_tree_insert_node(struct rb_tree *rbt, void *object) KASSERT(rb_tree_check_node(rbt, self, NULL, true)); } - /* Succesfully inserted, return our node pointer. */ + /* Successfully inserted, return our node pointer. */ return object; } diff --git a/compat/strlcpy.c b/compat/strlcpy.c index 1fb4a2f9..eceb4b4c 100644 --- a/compat/strlcpy.c +++ b/compat/strlcpy.c @@ -1,7 +1,7 @@ -/* $OpenBSD: strlcpy.c,v 1.15 2016/10/16 17:37:39 dtucker Exp $ */ +/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */ /* - * Copyright (c) 1998, 2015 Todd C. Miller + * Copyright (c) 1998, 2015 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above