Thu May 7 00:23:46 2009 UTC ()
Attempt to apply a bit of DWIM to previous (PR 41368).


(schmonz)
diff -r1.4 -r1.5 pkgsrc/pkgtools/libnbcompat/files/db/btree/bt_open.c
diff -r1.4 -r1.5 pkgsrc/pkgtools/libnbcompat/files/db/hash/hash_page.c

cvs diff -r1.4 -r1.5 pkgsrc/pkgtools/libnbcompat/files/db/btree/bt_open.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/libnbcompat/files/db/btree/bt_open.c 2009/05/06 16:57:31 1.4
+++ pkgsrc/pkgtools/libnbcompat/files/db/btree/bt_open.c 2009/05/07 00:23:45 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bt_open.c,v 1.4 2009/05/06 16:57:31 joerg Exp $ */ 1/* $NetBSD: bt_open.c,v 1.5 2009/05/07 00:23:45 schmonz Exp $ */
2/* NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp */ 2/* NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1990, 1993, 1994 5 * Copyright (c) 1990, 1993, 1994
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * Mike Olson. 9 * Mike Olson.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE. 33 * SUCH DAMAGE.
34 */ 34 */
35 35
36#include <nbcompat.h> 36#include <nbcompat.h>
37#include <nbcompat/cdefs.h> 37#include <nbcompat/cdefs.h>
38 38
39__RCSID("$NetBSD: bt_open.c,v 1.4 2009/05/06 16:57:31 joerg Exp $"); 39__RCSID("$NetBSD: bt_open.c,v 1.5 2009/05/07 00:23:45 schmonz Exp $");
40 40
41/* 41/*
42 * Implementation of btree access method for 4.4BSD. 42 * Implementation of btree access method for 4.4BSD.
43 * 43 *
44 * The design here was originally based on that of the btree access method 44 * The design here was originally based on that of the btree access method
45 * used in the Postgres database system at UC Berkeley. This implementation 45 * used in the Postgres database system at UC Berkeley. This implementation
46 * is wholly independent of the Postgres code. 46 * is wholly independent of the Postgres code.
47 */ 47 */
48 48
49#include <sys/stat.h> 49#include <sys/stat.h>
50 50
51#include <assert.h> 51#include <assert.h>
52#include <errno.h> 52#include <errno.h>
@@ -383,29 +383,29 @@ nroot(BTREE *t) @@ -383,29 +383,29 @@ nroot(BTREE *t)
383 mpool_put(t->bt_mp, meta, MPOOL_DIRTY); 383 mpool_put(t->bt_mp, meta, MPOOL_DIRTY);
384 mpool_put(t->bt_mp, root, MPOOL_DIRTY); 384 mpool_put(t->bt_mp, root, MPOOL_DIRTY);
385 return (RET_SUCCESS); 385 return (RET_SUCCESS);
386} 386}
387 387
388static int 388static int
389tmp(void) 389tmp(void)
390{ 390{
391 sigset_t set, oset; 391 sigset_t set, oset;
392 size_t len; 392 size_t len;
393 int fd; 393 int fd;
394 char *envtmp; 394 char *envtmp;
395#ifdef PATH_MAX 395#ifdef PATH_MAX
396 char namestr[PATH_MAX]; 396 char path[PATH_MAX];
397#lse 397#else
398 char namestr[MAXPATHLEN]; 398 char path[MAXPATHLEN];
399#endif 399#endif
400 400
401#if HAVE_ISSETUGID 401#if HAVE_ISSETUGID
402 if (issetugid()) 402 if (issetugid())
403 envtmp = NULL; 403 envtmp = NULL;
404 else 404 else
405#endif 405#endif
406 envtmp = getenv("TMPDIR"); 406 envtmp = getenv("TMPDIR");
407 407
408 len = snprintf(path, 408 len = snprintf(path,
409 sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : _PATH_TMP); 409 sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : _PATH_TMP);
410 if (len >= sizeof(path)) 410 if (len >= sizeof(path))
411 return -1; 411 return -1;

cvs diff -r1.4 -r1.5 pkgsrc/pkgtools/libnbcompat/files/db/hash/hash_page.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/libnbcompat/files/db/hash/hash_page.c 2009/05/06 16:57:31 1.4
+++ pkgsrc/pkgtools/libnbcompat/files/db/hash/hash_page.c 2009/05/07 00:23:45 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hash_page.c,v 1.4 2009/05/06 16:57:31 joerg Exp $ */ 1/* $NetBSD: hash_page.c,v 1.5 2009/05/07 00:23:45 schmonz Exp $ */
2/* NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp */ 2/* NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1990, 1993, 1994 5 * Copyright (c) 1990, 1993, 1994
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * Margo Seltzer. 9 * Margo Seltzer.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE. 33 * SUCH DAMAGE.
34 */ 34 */
35 35
36#include <nbcompat.h> 36#include <nbcompat.h>
37#include <nbcompat/cdefs.h> 37#include <nbcompat/cdefs.h>
38 38
39__RCSID("$NetBSD: hash_page.c,v 1.4 2009/05/06 16:57:31 joerg Exp $"); 39__RCSID("$NetBSD: hash_page.c,v 1.5 2009/05/07 00:23:45 schmonz Exp $");
40 40
41/* 41/*
42 * PACKAGE: hashing 42 * PACKAGE: hashing
43 * 43 *
44 * DESCRIPTION: 44 * DESCRIPTION:
45 * Page manipulation for hashing package. 45 * Page manipulation for hashing package.
46 * 46 *
47 * ROUTINES: 47 * ROUTINES:
48 * 48 *
49 * External 49 * External
50 * __get_page 50 * __get_page
51 * __add_ovflpage 51 * __add_ovflpage
52 * Internal 52 * Internal
@@ -857,27 +857,27 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *ob @@ -857,27 +857,27 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *ob
857 857
858/* 858/*
859 * Returns: 859 * Returns:
860 * 0 success 860 * 0 success
861 * -1 failure 861 * -1 failure
862 */ 862 */
863static int 863static int
864open_temp(HTAB *hashp) 864open_temp(HTAB *hashp)
865{ 865{
866 sigset_t set, oset; 866 sigset_t set, oset;
867 char *envtmp; 867 char *envtmp;
868#ifdef PATH_MAX 868#ifdef PATH_MAX
869 char namestr[PATH_MAX]; 869 char namestr[PATH_MAX];
870#lse 870#else
871 char namestr[MAXPATHLEN]; 871 char namestr[MAXPATHLEN];
872#endif 872#endif
873 873
874#if HAVE_ISSETUGID 874#if HAVE_ISSETUGID
875 if (issetugid()) 875 if (issetugid())
876 envtmp = NULL; 876 envtmp = NULL;
877 else 877 else
878#endif 878#endif
879 envtmp = getenv("TMPDIR"); 879 envtmp = getenv("TMPDIR");
880 880
881 if (-1 == snprintf(namestr, sizeof(namestr), "%s/_hashXXXXXX", 881 if (-1 == snprintf(namestr, sizeof(namestr), "%s/_hashXXXXXX",
882 envtmp ? envtmp : _PATH_TMP)) 882 envtmp ? envtmp : _PATH_TMP))
883 return -1; 883 return -1;