]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/nfsd/nfsd.c
2002-09-12 H.J. Lu <hjl@lucon.org>
[nfs-utils.git] / utils / nfsd / nfsd.c
index 772f72df54693751550eac1c9fbe978d427720b9..86e809499236c8a4bf3e3bf3c213d91dbcbdf4a1 100644 (file)
@@ -17,6 +17,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <syslog.h>
+#include <netdb.h>
 #include "nfslib.h"
 
 static void    usage(const char *);
@@ -25,10 +26,13 @@ int
 main(int argc, char **argv)
 {
        int     count = 1, c, error, port, fd;
+       struct servent *ent;
 
-       port = 2049;
-
-       /* FIXME: Check for nfs in /etc/services */
+       ent = getservbyname ("nfs", "udp");
+       if (ent != NULL)
+               port = ntohs (ent->s_port);
+       else
+               port = 2049;
 
        while ((c = getopt(argc, argv, "hp:P:")) != EOF) {
                switch(c) {