diff options
author | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-06-03 17:32:26 +0000 |
---|---|---|
committer | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-06-03 17:32:26 +0000 |
commit | 783b895d2b628ad1aaabfd77974cf2bd29fc502c (patch) | |
tree | c04fc562df22ad839973f6df8abd016f5bc334d9 /usr.sbin/ldapd/btree.c | |
parent | 39503557a09067aa36f1779fb9dcea1b261d47ec (diff) |
Fix compilation on gcc2. Check a return value from malloc while at it.
"that compiles!" deraadt@
Diffstat (limited to 'usr.sbin/ldapd/btree.c')
-rw-r--r-- | usr.sbin/ldapd/btree.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index ae4c2f00fc0..8397e23910d 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.3 2010/06/02 09:12:13 martinh Exp $ */ +/* $OpenBSD: btree.c,v 1.4 2010/06/03 17:32:25 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -173,7 +173,7 @@ struct node { uint16_t ksize; /* key size */ #define F_BIGDATA 0x01 /* data put on overflow page */ uint8_t flags; - char data[]; + char data[1]; }; struct btree_txn { @@ -2168,6 +2168,7 @@ btree_merge(struct btree *bt, struct mpage *src, struct mpage *dst) { int rc; indx_t i; + unsigned int pfxlen; struct node *srcnode; struct btkey tmpkey, dstpfx; struct btval key, data; @@ -2240,7 +2241,7 @@ btree_merge(struct btree *bt, struct mpage *src, struct mpage *dst) if (btree_update_key(bt, src->parent, 0, &key) != BT_SUCCESS) return BT_FAIL; - unsigned int pfxlen = src->prefix.len; + pfxlen = src->prefix.len; find_common_prefix(bt, src); assert (src->prefix.len == pfxlen); } |