diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-11 17:42:44 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-11 17:42:44 +0000 |
commit | 00d7d6cef6419654071ccc77d9b2f212198dab3d (patch) | |
tree | dd597506d203700ee8bdab93e5467cac0e2a1712 /util-linux/mount.c | |
parent | 64d7e93081141cb6f1668436a5629a2304047f38 (diff) | |
download | busybox-w32-00d7d6cef6419654071ccc77d9b2f212198dab3d.tar.gz busybox-w32-00d7d6cef6419654071ccc77d9b2f212198dab3d.tar.bz2 busybox-w32-00d7d6cef6419654071ccc77d9b2f212198dab3d.zip |
nfsmount: sanitize it. It had a rather peculiar idea of implementing "bg"
option - it was going to return a special flag back to caller and
expecting caller to call it again with special parameter! Also
caller was charged with calling mount() syscall...
mount: mtab support was non-functional. Enabling it revealed serious bug
which is not fixed yet.
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r-- | util-linux/mount.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index b1d9e287d..bd2a62d64 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -102,7 +102,7 @@ static void append_mount_options(char **oldopts, char *newopts) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* Use the mount_options list to parse options into flags. | 104 | /* Use the mount_options list to parse options into flags. |
105 | * Return list of unrecognized options in *strflags if strflags!=NULL */ | 105 | * Also return list of unrecognized options if unrecognized!=NULL */ |
106 | static int parse_mount_options(char *options, char **unrecognized) | 106 | static int parse_mount_options(char *options, char **unrecognized) |
107 | { | 107 | { |
108 | int flags = MS_SILENT; | 108 | int flags = MS_SILENT; |
@@ -188,7 +188,7 @@ void delete_block_backed_filesystems(void); | |||
188 | #endif | 188 | #endif |
189 | 189 | ||
190 | #if ENABLE_FEATURE_MTAB_SUPPORT | 190 | #if ENABLE_FEATURE_MTAB_SUPPORT |
191 | static int useMtab; | 191 | static int useMtab = 1; |
192 | static int fakeIt; | 192 | static int fakeIt; |
193 | #else | 193 | #else |
194 | #define useMtab 0 | 194 | #define useMtab 0 |
@@ -196,8 +196,7 @@ static int fakeIt; | |||
196 | #endif | 196 | #endif |
197 | 197 | ||
198 | // Perform actual mount of specific filesystem at specific location. | 198 | // Perform actual mount of specific filesystem at specific location. |
199 | 199 | int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts) | |
200 | static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts) | ||
201 | { | 200 | { |
202 | int rc; | 201 | int rc; |
203 | 202 | ||
@@ -228,7 +227,7 @@ static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts) | |||
228 | int i; | 227 | int i; |
229 | 228 | ||
230 | if(!mountTable) | 229 | if(!mountTable) |
231 | bb_error_msg("No %s",bb_path_mtab_file); | 230 | bb_error_msg("no %s",bb_path_mtab_file); |
232 | 231 | ||
233 | // Add vfs string flags | 232 | // Add vfs string flags |
234 | 233 | ||
@@ -244,7 +243,13 @@ static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts) | |||
244 | // Write and close. | 243 | // Write and close. |
245 | 244 | ||
246 | if(!mp->mnt_type || !*mp->mnt_type) mp->mnt_type="--bind"; | 245 | if(!mp->mnt_type || !*mp->mnt_type) mp->mnt_type="--bind"; |
247 | addmntent(mountTable, mp); | 246 | // addmntent(mountTable, mp); |
247 | if(0) bb_error_msg("buggy: addmntent(fsname='%s' dir='%s' type='%s' opts='%s')", | ||
248 | mp->mnt_fsname, | ||
249 | mp->mnt_dir, | ||
250 | mp->mnt_type, | ||
251 | mp->mnt_opts | ||
252 | ); | ||
248 | endmntent(mountTable); | 253 | endmntent(mountTable); |
249 | if (ENABLE_FEATURE_CLEAN_UP) | 254 | if (ENABLE_FEATURE_CLEAN_UP) |
250 | if(strcmp(mp->mnt_type,"--bind")) mp->mnt_type = 0; | 255 | if(strcmp(mp->mnt_type,"--bind")) mp->mnt_type = 0; |
@@ -319,13 +324,7 @@ static int singlemount(struct mntent *mp, int ignore_busy) | |||
319 | (!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) && | 324 | (!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) && |
320 | strchr(mp->mnt_fsname, ':') != NULL) | 325 | strchr(mp->mnt_fsname, ':') != NULL) |
321 | { | 326 | { |
322 | if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &filteropts, 1)) { | 327 | rc = nfsmount(mp, vfsflags, filteropts); |
323 | bb_perror_msg("nfsmount failed"); | ||
324 | } else { | ||
325 | // Strangely enough, nfsmount() doesn't actually mount() anything. | ||
326 | mp->mnt_type = "nfs"; | ||
327 | rc = mount_it_now(mp, vfsflags, filteropts); | ||
328 | } | ||
329 | goto report_error; | 328 | goto report_error; |
330 | } | 329 | } |
331 | 330 | ||
@@ -400,7 +399,8 @@ report_error: | |||
400 | 399 | ||
401 | if (rc && errno == EBUSY && ignore_busy) rc = 0; | 400 | if (rc && errno == EBUSY && ignore_busy) rc = 0; |
402 | if (rc < 0) | 401 | if (rc < 0) |
403 | bb_perror_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir); | 402 | /* perror here sometimes says "mounting ... on ... failed: Success" */ |
403 | bb_error_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir); | ||
404 | 404 | ||
405 | return rc; | 405 | return rc; |
406 | } | 406 | } |