summaryrefslogtreecommitdiffstats
path: root/src/plug-nis.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plug-nis.c')
-rw-r--r--src/plug-nis.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plug-nis.c b/src/plug-nis.c
index dfc776f..e6edf4a 100644
--- a/src/plug-nis.c
+++ b/src/plug-nis.c
@@ -307,9 +307,10 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate)
/* Figure out what kind of socket we need, and a textual
* term to use in log messages. */
pf = (i & 2) ? PF_INET : PF_INET6;
- type = (i & 1) ? SOCK_DGRAM : SOCK_STREAM;
- sock_desc = (i & 2) ? ((i & 1) ? "tcp" : "udp") :
- ((i & 1) ? "tcp6" : "udp6");
+ type = (i & 1) ? SOCK_STREAM: SOCK_DGRAM;
+ sock_desc = (pf == PF_INET6) ?
+ ((type == SOCK_DGRAM) ? "udp6" : "tcp6") :
+ ((type == SOCK_DGRAM) ? "udp" : "tcp");
/* Allocate the socket. */
sockfd = socket(pf, type, 0);
if (sockfd == -1) {