]> granicus.if.org Git - libtirpc/commitdiff
clnt_bcast: Convert local debug() calls to LIBTIRPC_DEBUG() calls
authorSteve Dickson <steved@redhat.com>
Mon, 14 Jul 2014 16:10:09 +0000 (12:10 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 7 Aug 2014 18:41:34 +0000 (14:41 -0400)
Signed-off-by: Steve Dickson <steved@redhat.com>
src/clnt_bcast.c

index 105554533e8ef457c31f981c3284b636c36c9a40..373d8a52569b9f08e11cce3265516328295f7a8a 100644 (file)
@@ -55,9 +55,7 @@
 #endif                         /* PORTMAP */
 #include <rpc/nettype.h>
 #include <arpa/inet.h>
-#ifdef RPC_DEBUG
 #include <stdio.h>
-#endif
 #include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -66,6 +64,7 @@
 #include <string.h>
 
 #include "rpc_com.h"
+#include "debug.h"
 
 #define        MAXBCAST 20     /* Max no of broadcasting transports */
 #define        INITTIME 4000   /* Time to wait initially */
@@ -454,20 +453,15 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
                                            outlen, 0, (struct sockaddr*)addr,
                                            (size_t)fdlist[i].asize) !=
                                            outlen) {
-#ifdef RPC_DEBUG
-                                               perror("sendto");
-#endif
-                                               warnx("clnt_bcast: cannot send"
-                                                     "broadcast packet");
+                                               LIBTIRPC_DEBUG(1, 
+                                                       ("rpc_broadcast_exp: sendto failed: errno %d", errno));
+                                               warnx("rpc_broadcast_exp: cannot send broadcast packet");
                                                stat = RPC_CANTSEND;
                                                continue;
                                        };
-#ifdef RPC_DEBUG
                                if (!__rpc_lowvers)
-                                       fprintf(stderr, "Broadcast packet sent "
-                                               "for %s\n",
-                                                fdlist[i].nconf->nc_netid);
-#endif
+                                       LIBTIRPC_DEBUG(3, ("rpc_broadcast_exp: Broadcast packet sent for %s\n",
+                                                fdlist[i].nconf->nc_netid));
 #ifdef PORTMAP
                                /*
                                 * Send the version 2 packet also
@@ -485,11 +479,8 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
                                                continue;
                                        }
                                }
-#ifdef RPC_DEBUG
-                               fprintf(stderr, "PMAP Broadcast packet "
-                                       "sent for %s\n",
-                                       fdlist[i].nconf->nc_netid);
-#endif
+                               LIBTIRPC_DEBUG(3, ("rpc_broadcast_exp: PMAP Broadcast packet sent for %s\n",
+                                       fdlist[i].nconf->nc_netid));
 #endif                         /* PORTMAP */
                        }
                        /* End for sending all packets on this transport */
@@ -532,10 +523,8 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
                                continue;
                        } else
                                fds_found++;
-#ifdef RPC_DEBUG
-                       fprintf(stderr, "response for %s\n",
-                               fdlist[i].nconf->nc_netid);
-#endif
+                       LIBTIRPC_DEBUG(3, ("rpc_broadcast_exp: response for %s\n", 
+                               fdlist[i].nconf->nc_netid));
                try_again:
                        inlen = recvfrom(fdlist[i].fd, inbuf, fdlist[i].dsize,
                            0, (struct sockaddr *)(void *)&fdlist[i].raddr,
@@ -596,10 +585,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
                                                    &taddr, fdlist[i].nconf);
                                        } else {
 #endif                         /* PORTMAP */
-#ifdef RPC_DEBUG
-                                               fprintf(stderr, "uaddr %s\n",
-                                                   uaddrp);
-#endif
+                                               LIBTIRPC_DEBUG(3, ("rpc_broadcast_exp: uaddr %s\n", uaddrp));
                                                np = uaddr2taddr(
                                                    fdlist[i].nconf, uaddrp);
                                                done = (*eachresult)(resultsp,