From e4c83815ad1c33d67a9d2078e7eebbbeeb00dd15 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 30 Aug 2016 21:37:24 +0000 Subject: less confusing warning message about negative offsets --- dbm_map.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dbm_map.c b/dbm_map.c index ddcb032c..2207b555 100644 --- a/dbm_map.c +++ b/dbm_map.c @@ -1,4 +1,4 @@ -/* $Id: dbm_map.c,v 1.4 2016/08/22 16:07:16 schwarze Exp $ */ +/* $Id: dbm_map.c,v 1.5 2016/08/30 21:37:24 schwarze Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze * @@ -143,7 +143,11 @@ void * dbm_get(int32_t offset) { offset = be32toh(offset); - if (offset < 0 || offset >= max_offset) { + if (offset < 0) { + warnx("dbm_get: Database corrupt: offset %d", offset); + return NULL; + } + if (offset >= max_offset) { warnx("dbm_get: Database corrupt: offset %d > %d", offset, max_offset); return NULL; -- cgit v1.2.3-56-ge451