svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Tue Aug 28 11:23:25 UTC 2007


Author: vda
Date: 2007-08-28 04:23:23 -0700 (Tue, 28 Aug 2007)
New Revision: 19711

Log:
mount: don't close fd twice in NFS code



Modified:
   trunk/busybox/util-linux/mount.c


Changeset:
Modified: trunk/busybox/util-linux/mount.c
===================================================================
--- trunk/busybox/util-linux/mount.c	2007-08-28 08:14:51 UTC (rev 19710)
+++ trunk/busybox/util-linux/mount.c	2007-08-28 11:23:23 UTC (rev 19711)
@@ -1087,7 +1087,7 @@
 	 * give up immediately, to avoid the initial timeout.
 	 */
 	if (bg && we_saw_this_host_before(hostname)) {
-		daemonized = daemonize(); /* parent or error */
+		daemonized = daemonize();
 		if (daemonized <= 0) { /* parent or error */
 			retval = -daemonized;
 			goto ret;
@@ -1178,7 +1178,7 @@
 						 &msock, 0, 0);
 			break;
 		default:
-			mclient = 0;
+			mclient = NULL;
 		}
 		if (!mclient) {
 			if (!daemonized && prevt == 0)
@@ -1219,8 +1219,9 @@
 				error_msg_rpc(clnt_sperror(mclient, " "));
 			auth_destroy(mclient->cl_auth);
 			clnt_destroy(mclient);
-			mclient = 0;
+			mclient = NULL;
 			close(msock);
+			msock = -1;
 		}
 
 		/* Timeout. We are going to retry... maybe */
@@ -1316,6 +1317,7 @@
 	auth_destroy(mclient->cl_auth);
 	clnt_destroy(mclient);
 	close(msock);
+	msock = -1;
 
 	if (bg) {
 		/* We must wait until mount directory is available */
@@ -1325,6 +1327,7 @@
 			if (!daemonized) {
 				daemonized = daemonize();
 				if (daemonized <= 0) { /* parent or error */
+	// FIXME: parent doesn't close fsock - ??!
 					retval = -daemonized;
 					goto ret;
 				}
@@ -1344,14 +1347,14 @@
 
 fail:	/* abort */
 
-	if (msock != -1) {
+	if (msock >= 0) {
 		if (mclient) {
 			auth_destroy(mclient->cl_auth);
 			clnt_destroy(mclient);
 		}
 		close(msock);
 	}
-	if (fsock != -1)
+	if (fsock >= 0)
 		close(fsock);
 
 ret:




More information about the busybox-cvs mailing list