diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-28 11:23:23 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-28 11:23:23 +0000 |
| commit | 7d8de4d55dbc140ea0dc0131bb0647f9632cc7e9 (patch) | |
| tree | b016e9bc3a8ee42e1a0249ea214b8b6e8ec3e55b /util-linux | |
| parent | 0f214ecef0a65fee01b12e2d75b80c398332b3ba (diff) | |
| download | busybox-w32-7d8de4d55dbc140ea0dc0131bb0647f9632cc7e9.tar.gz busybox-w32-7d8de4d55dbc140ea0dc0131bb0647f9632cc7e9.tar.bz2 busybox-w32-7d8de4d55dbc140ea0dc0131bb0647f9632cc7e9.zip | |
mount: don't close fd twice in NFS code
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/mount.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index e9bf2a8d3..0819be4d1 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -1087,7 +1087,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) | |||
| 1087 | * give up immediately, to avoid the initial timeout. | 1087 | * give up immediately, to avoid the initial timeout. |
| 1088 | */ | 1088 | */ |
| 1089 | if (bg && we_saw_this_host_before(hostname)) { | 1089 | if (bg && we_saw_this_host_before(hostname)) { |
| 1090 | daemonized = daemonize(); /* parent or error */ | 1090 | daemonized = daemonize(); |
| 1091 | if (daemonized <= 0) { /* parent or error */ | 1091 | if (daemonized <= 0) { /* parent or error */ |
| 1092 | retval = -daemonized; | 1092 | retval = -daemonized; |
| 1093 | goto ret; | 1093 | goto ret; |
| @@ -1178,7 +1178,7 @@ retry: | |||
| 1178 | &msock, 0, 0); | 1178 | &msock, 0, 0); |
| 1179 | break; | 1179 | break; |
| 1180 | default: | 1180 | default: |
| 1181 | mclient = 0; | 1181 | mclient = NULL; |
| 1182 | } | 1182 | } |
| 1183 | if (!mclient) { | 1183 | if (!mclient) { |
| 1184 | if (!daemonized && prevt == 0) | 1184 | if (!daemonized && prevt == 0) |
| @@ -1219,8 +1219,9 @@ retry: | |||
| 1219 | error_msg_rpc(clnt_sperror(mclient, " ")); | 1219 | error_msg_rpc(clnt_sperror(mclient, " ")); |
| 1220 | auth_destroy(mclient->cl_auth); | 1220 | auth_destroy(mclient->cl_auth); |
| 1221 | clnt_destroy(mclient); | 1221 | clnt_destroy(mclient); |
| 1222 | mclient = 0; | 1222 | mclient = NULL; |
| 1223 | close(msock); | 1223 | close(msock); |
| 1224 | msock = -1; | ||
| 1224 | } | 1225 | } |
| 1225 | 1226 | ||
| 1226 | /* Timeout. We are going to retry... maybe */ | 1227 | /* Timeout. We are going to retry... maybe */ |
| @@ -1316,6 +1317,7 @@ prepare_kernel_data: | |||
| 1316 | auth_destroy(mclient->cl_auth); | 1317 | auth_destroy(mclient->cl_auth); |
| 1317 | clnt_destroy(mclient); | 1318 | clnt_destroy(mclient); |
| 1318 | close(msock); | 1319 | close(msock); |
| 1320 | msock = -1; | ||
| 1319 | 1321 | ||
| 1320 | if (bg) { | 1322 | if (bg) { |
| 1321 | /* We must wait until mount directory is available */ | 1323 | /* We must wait until mount directory is available */ |
| @@ -1325,6 +1327,7 @@ prepare_kernel_data: | |||
| 1325 | if (!daemonized) { | 1327 | if (!daemonized) { |
| 1326 | daemonized = daemonize(); | 1328 | daemonized = daemonize(); |
| 1327 | if (daemonized <= 0) { /* parent or error */ | 1329 | if (daemonized <= 0) { /* parent or error */ |
| 1330 | // FIXME: parent doesn't close fsock - ??! | ||
| 1328 | retval = -daemonized; | 1331 | retval = -daemonized; |
| 1329 | goto ret; | 1332 | goto ret; |
| 1330 | } | 1333 | } |
| @@ -1344,14 +1347,14 @@ do_mount: /* perform actual mount */ | |||
| 1344 | 1347 | ||
| 1345 | fail: /* abort */ | 1348 | fail: /* abort */ |
| 1346 | 1349 | ||
| 1347 | if (msock != -1) { | 1350 | if (msock >= 0) { |
| 1348 | if (mclient) { | 1351 | if (mclient) { |
| 1349 | auth_destroy(mclient->cl_auth); | 1352 | auth_destroy(mclient->cl_auth); |
| 1350 | clnt_destroy(mclient); | 1353 | clnt_destroy(mclient); |
| 1351 | } | 1354 | } |
| 1352 | close(msock); | 1355 | close(msock); |
| 1353 | } | 1356 | } |
| 1354 | if (fsock != -1) | 1357 | if (fsock >= 0) |
| 1355 | close(fsock); | 1358 | close(fsock); |
| 1356 | 1359 | ||
| 1357 | ret: | 1360 | ret: |
