From c733f9b08d9eadc5e671185112567ada81116bdf Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Wed, 24 May 2017 13:51:31 +0200 Subject: Prep v230: Apply missing upstream fixes and updates (2/8) src/basic. --- src/basic/hashmap.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/basic/hashmap.c') diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 75ea2e30b..c89630f04 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -1777,20 +1777,18 @@ int set_consume(Set *s, void *value) { int set_put_strdup(Set *s, const char *p) { char *c; - int r; assert(s); assert(p); + if (set_contains(s, (char*) p)) + return 0; + c = strdup(p); if (!c) return -ENOMEM; - r = set_consume(s, c); - if (r == -EEXIST) - return 0; - - return r; + return set_consume(s, c); } #if 0 /// UNNEEDED by elogind -- cgit v1.2.3