when ioctl() for getting the broadcast address fails, continue the loop to the next...
[deb_libnfs.git] / examples / nfsclient-bcast.c
index 2075f09371e2e98f7981522e36d0d8d7d13f4432..f461a29adb2de0dc9df9c553a4f5b6da024c8494 100644 (file)
 #include "libnfs-raw.h"
 #include "libnfs-raw-mount.h"
 #include "libnfs-raw-portmap.h"
-#include "libnfs-private.h"
-
-struct nfs_server_list {
-       struct nfs_server_list *next;
-       char *addr;
-};
 
 struct nfs_list_data {
        int status;
@@ -56,9 +50,8 @@ void free_nfs_srvr_list(struct nfs_server_list *srv)
        }
 }           
 
-void pm_cb(struct rpc_context *rpc, int status, void *data, void *private_data _U_)
+void pm_cb(struct rpc_context *rpc, int status, void *data _U_, void *private_data)
 {
-       pmap_call_result *res = (pmap_call_result *)data;
        struct nfs_list_data *srv_data = private_data;
        struct sockaddr *sin;
        char hostdd[16];
@@ -144,7 +137,7 @@ int main(int argc _U_, char *argv[] _U_)
                }
        }       
 
-       for (i=0; i<ifc.ifc_len / sizeof(struct ifconf); i++) {
+       for (i = 0; (unsigned)i < ifc.ifc_len / sizeof(struct ifconf); i++) {
                char bcdd[16];
 
                if (ifc.ifc_req[i].ifr_addr.sa_family != AF_INET) {
@@ -164,12 +157,10 @@ int main(int argc _U_, char *argv[] _U_)
                        continue;
                }
                if (ioctl(rpc_get_fd(rpc), SIOCGIFBRDADDR, &ifc.ifc_req[i]) < 0) {
-                       printf("ioctl DRBADDR failed\n");
-                       exit(10);
+                       continue;
                }
                if (getnameinfo(&ifc.ifc_req[i].ifr_broadaddr, sizeof(struct sockaddr_in), &bcdd[0], sizeof(bcdd), NULL, 0, NI_NUMERICHOST) < 0) {
-                       printf("getnameinfo failed\n");
-                       exit(10);
+                       continue;
                }
                if (rpc_set_udp_destination(rpc, bcdd, 111, 1) < 0) {
                        printf("failed to set udp destination %s\n", rpc_get_error(rpc));