mount: don't close fd twice in NFS code
This commit is contained in:
parent
0f214ecef0
commit
7d8de4d55d
@ -1087,7 +1087,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts)
|
|||||||
* give up immediately, to avoid the initial timeout.
|
* give up immediately, to avoid the initial timeout.
|
||||||
*/
|
*/
|
||||||
if (bg && we_saw_this_host_before(hostname)) {
|
if (bg && we_saw_this_host_before(hostname)) {
|
||||||
daemonized = daemonize(); /* parent or error */
|
daemonized = daemonize();
|
||||||
if (daemonized <= 0) { /* parent or error */
|
if (daemonized <= 0) { /* parent or error */
|
||||||
retval = -daemonized;
|
retval = -daemonized;
|
||||||
goto ret;
|
goto ret;
|
||||||
@ -1178,7 +1178,7 @@ retry:
|
|||||||
&msock, 0, 0);
|
&msock, 0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mclient = 0;
|
mclient = NULL;
|
||||||
}
|
}
|
||||||
if (!mclient) {
|
if (!mclient) {
|
||||||
if (!daemonized && prevt == 0)
|
if (!daemonized && prevt == 0)
|
||||||
@ -1219,8 +1219,9 @@ retry:
|
|||||||
error_msg_rpc(clnt_sperror(mclient, " "));
|
error_msg_rpc(clnt_sperror(mclient, " "));
|
||||||
auth_destroy(mclient->cl_auth);
|
auth_destroy(mclient->cl_auth);
|
||||||
clnt_destroy(mclient);
|
clnt_destroy(mclient);
|
||||||
mclient = 0;
|
mclient = NULL;
|
||||||
close(msock);
|
close(msock);
|
||||||
|
msock = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timeout. We are going to retry... maybe */
|
/* Timeout. We are going to retry... maybe */
|
||||||
@ -1316,6 +1317,7 @@ prepare_kernel_data:
|
|||||||
auth_destroy(mclient->cl_auth);
|
auth_destroy(mclient->cl_auth);
|
||||||
clnt_destroy(mclient);
|
clnt_destroy(mclient);
|
||||||
close(msock);
|
close(msock);
|
||||||
|
msock = -1;
|
||||||
|
|
||||||
if (bg) {
|
if (bg) {
|
||||||
/* We must wait until mount directory is available */
|
/* We must wait until mount directory is available */
|
||||||
@ -1325,6 +1327,7 @@ prepare_kernel_data:
|
|||||||
if (!daemonized) {
|
if (!daemonized) {
|
||||||
daemonized = daemonize();
|
daemonized = daemonize();
|
||||||
if (daemonized <= 0) { /* parent or error */
|
if (daemonized <= 0) { /* parent or error */
|
||||||
|
// FIXME: parent doesn't close fsock - ??!
|
||||||
retval = -daemonized;
|
retval = -daemonized;
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@ -1344,14 +1347,14 @@ do_mount: /* perform actual mount */
|
|||||||
|
|
||||||
fail: /* abort */
|
fail: /* abort */
|
||||||
|
|
||||||
if (msock != -1) {
|
if (msock >= 0) {
|
||||||
if (mclient) {
|
if (mclient) {
|
||||||
auth_destroy(mclient->cl_auth);
|
auth_destroy(mclient->cl_auth);
|
||||||
clnt_destroy(mclient);
|
clnt_destroy(mclient);
|
||||||
}
|
}
|
||||||
close(msock);
|
close(msock);
|
||||||
}
|
}
|
||||||
if (fsock != -1)
|
if (fsock >= 0)
|
||||||
close(fsock);
|
close(fsock);
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user