diff options
author | Andreas Schneider <asn@samba.org> | 2017-12-07 15:54:13 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-03-20 23:16:16 +0100 |
commit | da68a1b2f417ec82ea4ed3e7a4d867cef8ca8f93 (patch) | |
tree | 744f0f0e7f621a3fc32b5a3ca6ac34f573465f24 /lib/socket | |
parent | dcd0a7f738dabc67aef73abc805eb9eb0d226e8d (diff) | |
download | samba-da68a1b2f417ec82ea4ed3e7a4d867cef8ca8f93.tar.gz |
lib:socket: Return early if we have only one interface
This fixes compilation with -Wstrict-overflow=2
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/socket')
-rw-r--r-- | lib/socket/interfaces.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |