From: Andreas Schneider Date: Thu, 7 Dec 2017 14:54:13 +0000 (+0100) Subject: lib:socket: Return early if we have only one interface X-Git-Tag: talloc-2.1.12~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da68a1b2f417ec82ea4ed3e7a4d867cef8ca8f93;p=thirdparty%2Fsamba.git lib:socket: Return early if we have only one interface This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c index 6409275d7bc..168bff501c2 100644 --- a/lib/socket/interfaces.c +++ b/lib/socket/interfaces.c @@ -367,7 +367,10 @@ int get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces) int total, i, j; total = _get_interfaces(mem_ctx, &ifaces); - if (total <= 0) return total; + /* If we have an error, no interface or just one we can leave */ + if (total <= 1) { + return total; + } /* now we need to remove duplicates */ TYPESAFE_QSORT(ifaces, total, iface_comp);