torrentd

simple torrent daemon
git clone git://git.2f30.org/torrentd
Log | Files | Refs | LICENSE

commit c6392def816e6f93c59e323b777d3aebb4a385c5
parent f3d95379428c90ae60c3e8bb6dc4594d28e6661b
Author: sin <sin@2f30.org>
Date:   Thu, 17 Dec 2015 15:54:44 +0000

Don't exit on error

Diffstat:
Mben.c | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ben.c b/ben.c @@ -15,7 +15,6 @@ */ #include <ctype.h> -#include <err.h> #include <setjmp.h> #include <stdint.h> #include <stdio.h> @@ -205,7 +204,7 @@ bstrcmp(struct ben *a, struct ben *b) long long int i; if (a->type != 's' || b->type != 's') - errx(1, "bstrcmp expects a string"); + return 1; if (a->len != b->len) return 1; for (i = 0; i < a->len; i++) @@ -219,10 +218,8 @@ dlook(struct ben *d, struct ben *k) { struct ben *b; - if (d->type != 'd') - errx(1, "dlook expects a dictionary"); - if (k->type != 's') - errx(1, "dlook requires key to be a string"); + if (d->type != 'd' || k->type != 's') + return NULL; for (b = d; b; b = b->next) if (!bstrcmp(b->k, k)) return b->v;