| @@ -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 | |
388 | static int | | 388 | static int |
389 | tmp(void) | | 389 | tmp(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; |