]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/statd/rmtcall.c
2001-03-21 H.J. Lu <hjl@lucon.org>
[nfs-utils.git] / utils / statd / rmtcall.c
index 3d9e7cc01ea9858dbd6d21014591506d0d3d7440..f01faba06e1a7be80a5c0c3c344cccc1fd58e776 100644 (file)
@@ -30,6 +30,7 @@
 #include <rpc/rpc.h>
 #include <rpc/pmap_prot.h>
 #include <rpc/pmap_rmt.h>
+#include <time.h>
 #include <netdb.h>
 #include <string.h>
 #include <unistd.h>
@@ -46,8 +47,8 @@ static int            sockfd = -1;    /* notify socket */
 /*
  * Initialize callback socket
  */
-static int
-get_socket(void)
+int
+statd_get_socket(int port)
 {
        struct sockaddr_in      sin;
 
@@ -63,6 +64,7 @@ get_socket(void)
 
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
+       sin.sin_port = port;
        if (bindresvport(sockfd, &sin) < 0) {
                dprintf(L_WARNING,
                        "process_hosts: can't bind to reserved port\n");
@@ -393,7 +395,7 @@ process_notify_list(void)
        time_t          now;
        int             fd;
 
-       if ((fd = get_socket()) < 0)
+       if ((fd = statd_get_socket(0)) < 0)
                return 0;
 
        while ((entry = notify) != NULL && NL_WHEN(entry) < time(&now)) {