From 13dd03a0e2605f0ec2da811aa814a58bc2dd9a3d Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 8 Jan 2003 11:16:48 +1100 Subject: [PATCH] - (djm) Sync openbsd-compat/ with OpenBSD -current --- ChangeLog | 5 ++++- openbsd-compat/getcwd.c | 4 ++-- openbsd-compat/getopt.c | 5 ++++- openbsd-compat/setenv.c | 5 +++-- openbsd-compat/sys-tree.h | 8 +++++--- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2441fdfa9..0e00a6c9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +20030108 + - (djm) Sync openbsd-compat/ with OpenBSD -current + 20030107 - (djm) Bug #401: Work around Linux breakage with IPv6 mapped addresses. Based on fix from yoshfuji@linux-ipv6.org @@ -942,4 +945,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2548 2003/01/07 12:55:59 djm Exp $ +$Id: ChangeLog,v 1.2549 2003/01/08 00:16:48 djm Exp $ diff --git a/openbsd-compat/getcwd.c b/openbsd-compat/getcwd.c index 6fd8543a5..f4b98e824 100644 --- a/openbsd-compat/getcwd.c +++ b/openbsd-compat/getcwd.c @@ -29,7 +29,7 @@ #if !defined(HAVE_GETCWD) #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getcwd.c,v 1.6 2000/07/19 15:25:13 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: getcwd.c,v 1.7 2002/11/24 01:52:27 cloder Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -127,7 +127,7 @@ getcwd(char *pt,size_t size) /* * Build pointer to the parent directory, allocating memory * as necessary. Max length is 3 for "../", the largest - * possible component name, plus a trailing NULL. + * possible component name, plus a trailing NUL. */ if (bup + 3 + MAXNAMLEN + 1 >= eup) { char *nup; diff --git a/openbsd-compat/getopt.c b/openbsd-compat/getopt.c index 4a5cfe5f0..a3fe807ee 100644 --- a/openbsd-compat/getopt.c +++ b/openbsd-compat/getopt.c @@ -35,7 +35,7 @@ #if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET) #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: getopt.c,v 1.2 1996/08/19 08:33:32 tholo Exp $"; +static char *rcsid = "$OpenBSD: getopt.c,v 1.4 2002/12/08 22:57:14 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -66,6 +66,9 @@ BSDgetopt(nargc, nargv, ostr) static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ + if (ostr == NULL) + return (-1); + if (BSDoptreset || !*place) { /* update scanning pointer */ BSDoptreset = 0; if (BSDoptind >= nargc || *(place = nargv[BSDoptind]) != '-') { diff --git a/openbsd-compat/setenv.c b/openbsd-compat/setenv.c index 1dff15c73..e5c5de62e 100644 --- a/openbsd-compat/setenv.c +++ b/openbsd-compat/setenv.c @@ -35,12 +35,14 @@ #ifndef HAVE_SETENV #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: setenv.c,v 1.4 2001/07/09 06:57:45 deraadt Exp $"; +static char *rcsid = "$OpenBSD: setenv.c,v 1.5 2002/12/10 22:44:13 mickey Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include +char *__findenv(const char *name, int *offset); + /* * __findenv -- * Returns pointer to value associated with name, if any, else NULL. @@ -92,7 +94,6 @@ setenv(name, value, rewrite) static int alloced; /* if allocated space before */ register char *C; int l_value, offset; - char *__findenv(); if (*value == '=') /* no `=' in value */ ++value; diff --git a/openbsd-compat/sys-tree.h b/openbsd-compat/sys-tree.h index 0a58710c9..927ca04cd 100644 --- a/openbsd-compat/sys-tree.h +++ b/openbsd-compat/sys-tree.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.h,v 1.6 2002/06/11 22:09:52 provos Exp $ */ +/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ /* * Copyright 2002 Niels Provos * All rights reserved. @@ -343,12 +343,13 @@ struct { \ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ else \ RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - RB_AUGMENT(RB_PARENT(elm, field)); \ } else \ (head)->rbh_root = (tmp); \ RB_LEFT(tmp, field) = (elm); \ RB_PARENT(elm, field) = (tmp); \ RB_AUGMENT(tmp); \ + if ((RB_PARENT(tmp, field))) \ + RB_AUGMENT(RB_PARENT(tmp, field)); \ } while (0) #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ @@ -362,12 +363,13 @@ struct { \ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ else \ RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - RB_AUGMENT(RB_PARENT(elm, field)); \ } else \ (head)->rbh_root = (tmp); \ RB_RIGHT(tmp, field) = (elm); \ RB_PARENT(elm, field) = (tmp); \ RB_AUGMENT(tmp); \ + if ((RB_PARENT(tmp, field))) \ + RB_AUGMENT(RB_PARENT(tmp, field)); \ } while (0) /* Generates prototypes and inline functions */