X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fstrmap%2Fstrmap.c;fp=ccan%2Fstrmap%2Fstrmap.c;h=2b89fe0da66cdf8185b4096681175601a2a01fb0;hb=ed1b25bbd01f79b5b333fd28b53455d2c91b831f;hp=7d03cca43ad7ff709bdcd9699ac31b5ad74fe309;hpb=2d31e99c851a669e22b79b9a8107b148c280816f;p=ccan diff --git a/ccan/strmap/strmap.c b/ccan/strmap/strmap.c index 7d03cca4..2b89fe0d 100644 --- a/ccan/strmap/strmap.c +++ b/ccan/strmap/strmap.c @@ -5,6 +5,7 @@ #include #include #include +#include struct node { /* These point to strings or nodes. */ @@ -72,6 +73,7 @@ bool strmap_add_(struct strmap *map, const char *member, const void *value) for (byte_num = 0; n->u.s[byte_num] == member[byte_num]; byte_num++) { if (member[byte_num] == '\0') { /* All identical! */ + errno = EEXIST; return false; } } @@ -86,7 +88,7 @@ bool strmap_add_(struct strmap *map, const char *member, const void *value) /* Allocate new node. */ newn = malloc(sizeof(*newn)); if (!newn) { - /* FIXME */ + errno = ENOMEM; return false; } newn->byte_num = byte_num;