Fixed a memory leak in lash. It seems that close_all was calling close()
[oweals/busybox.git] / nfsmount.c
index 397858b7196515a4a5d7f7d4ada25a418a4d6905..aee496980dafa808fa0aea422ee1c91569bddb7f 100644 (file)
  * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
  */
 
-#include "busybox.h"
-#undef FALSE
-#undef TRUE
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <netdb.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
 #include <sys/socket.h>
-#include <sys/time.h>
+#include <time.h>
 #include <sys/utsname.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-
-#include "nfsmount.h"
+#include <stdlib.h>
+#include "busybox.h"
+#undef TRUE
+#undef FALSE
+#include <rpc/rpc.h>
+#include <rpc/pmap_prot.h>
+#include <rpc/pmap_clnt.h>
 #include <linux/nfs.h>  /* For the kernels nfs stuff */
+#include "nfsmount.h"
 
 #ifndef NFS_FHSIZE
 static const int NFS_FHSIZE = 32;
@@ -183,7 +183,8 @@ static int nfs_mount_version;
  *     nfs_mount_version: version this source and running kernel can handle
  */
 static void
-find_kernel_nfs_mount_version(void) {
+find_kernel_nfs_mount_version(void)
+{
        static int kernel_version = 0;
 
        if (kernel_version)
@@ -193,15 +194,17 @@ find_kernel_nfs_mount_version(void) {
 
        kernel_version = get_kernel_revision();
        if (kernel_version) {
-            if (kernel_version < MAKE_VERSION(2,1,32))
-                 nfs_mount_version = 1;
-            else if (kernel_version < MAKE_VERSION(2,3,99))
-                 nfs_mount_version = 3;
-            else
-                 nfs_mount_version = 4; /* since 2.3.99pre4 */
+               if (kernel_version < MAKE_VERSION(2,1,32))
+                       nfs_mount_version = 1;
+               else if (kernel_version < MAKE_VERSION(2,2,18) ||
+                               (kernel_version >=   MAKE_VERSION(2,3,0) &&
+                                kernel_version < MAKE_VERSION(2,3,99)))
+                       nfs_mount_version = 3;
+               else
+                       nfs_mount_version = 4; /* since 2.3.99pre4 */
        }
        if (nfs_mount_version > NFS_MOUNT_VERSION)
-            nfs_mount_version = NFS_MOUNT_VERSION;
+               nfs_mount_version = NFS_MOUNT_VERSION;
 }
 
 static struct pmap *