diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /util-linux/mount.c | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r-- | util-linux/mount.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index b3e945ce3..d02005600 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -86,8 +86,6 @@ extern int umount2(__const char *__special_file, int __flags); | |||
86 | 86 | ||
87 | extern int sysfs(int option, unsigned int fs_index, char *buf); | 87 | extern int sysfs(int option, unsigned int fs_index, char *buf); |
88 | 88 | ||
89 | extern const char mtab_file[]; /* Defined in utility.c */ | ||
90 | |||
91 | struct mount_options { | 89 | struct mount_options { |
92 | const char *name; | 90 | const char *name; |
93 | unsigned long and; | 91 | unsigned long and; |
@@ -136,20 +134,20 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, long flags, | |||
136 | 134 | ||
137 | specialfile = find_unused_loop_device(); | 135 | specialfile = find_unused_loop_device(); |
138 | if (specialfile == NULL) { | 136 | if (specialfile == NULL) { |
139 | error_msg_and_die("Could not find a spare loop device"); | 137 | bb_error_msg_and_die("Could not find a spare loop device"); |
140 | } | 138 | } |
141 | if (set_loop(specialfile, lofile, 0, &loro)) { | 139 | if (set_loop(specialfile, lofile, 0, &loro)) { |
142 | error_msg_and_die("Could not setup loop device"); | 140 | bb_error_msg_and_die("Could not setup loop device"); |
143 | } | 141 | } |
144 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
145 | error_msg("WARNING: loop device is read-only"); | 143 | bb_error_msg("WARNING: loop device is read-only"); |
146 | flags |= MS_RDONLY; | 144 | flags |= MS_RDONLY; |
147 | } | 145 | } |
148 | } | 146 | } |
149 | #endif | 147 | #endif |
150 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); | 148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
151 | if (status < 0 && errno == EROFS) { | 149 | if (status < 0 && errno == EROFS) { |
152 | error_msg("%s is write-protected, mounting read-only", | 150 | bb_error_msg("%s is write-protected, mounting read-only", |
153 | specialfile); | 151 | specialfile); |
154 | status = mount(specialfile, dir, filesystemtype, flags |= | 152 | status = mount(specialfile, dir, filesystemtype, flags |= |
155 | MS_RDONLY, string_flags); | 153 | MS_RDONLY, string_flags); |
@@ -181,7 +179,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, long flags, | |||
181 | #endif | 179 | #endif |
182 | 180 | ||
183 | if (errno == EPERM) { | 181 | if (errno == EPERM) { |
184 | error_msg_and_die("permission denied. Are you root?"); | 182 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); |
185 | } | 183 | } |
186 | 184 | ||
187 | return (FALSE); | 185 | return (FALSE); |
@@ -268,7 +266,7 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
268 | 266 | ||
269 | filesystemType = buf; | 267 | filesystemType = buf; |
270 | 268 | ||
271 | if (xstrlen(filesystemType)) { | 269 | if (bb_strlen(filesystemType)) { |
272 | status = | 270 | status = |
273 | do_mount(blockDevice, directory, filesystemType, | 271 | do_mount(blockDevice, directory, filesystemType, |
274 | flags | MS_MGC_VAL, string_flags, | 272 | flags | MS_MGC_VAL, string_flags, |
@@ -284,7 +282,7 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
284 | } | 282 | } |
285 | 283 | ||
286 | if ((!f || read_proc) && !status) { | 284 | if ((!f || read_proc) && !status) { |
287 | f = xfopen("/proc/filesystems", "r"); | 285 | f = bb_xfopen("/proc/filesystems", "r"); |
288 | 286 | ||
289 | while (fgets(buf, sizeof(buf), f) != NULL) { | 287 | while (fgets(buf, sizeof(buf), f) != NULL) { |
290 | filesystemType = buf; | 288 | filesystemType = buf; |
@@ -319,7 +317,7 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
319 | 317 | ||
320 | if (!status) { | 318 | if (!status) { |
321 | if (whineOnErrors) { | 319 | if (whineOnErrors) { |
322 | perror_msg("Mounting %s on %s failed", blockDevice, directory); | 320 | bb_perror_msg("Mounting %s on %s failed", blockDevice, directory); |
323 | } | 321 | } |
324 | return (FALSE); | 322 | return (FALSE); |
325 | } | 323 | } |
@@ -328,7 +326,7 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
328 | 326 | ||
329 | static void show_mounts(char *onlytype) | 327 | static void show_mounts(char *onlytype) |
330 | { | 328 | { |
331 | FILE *mountTable = setmntent(mtab_file, "r"); | 329 | FILE *mountTable = setmntent(bb_path_mtab_file, "r"); |
332 | 330 | ||
333 | if (mountTable) { | 331 | if (mountTable) { |
334 | struct mntent *m; | 332 | struct mntent *m; |
@@ -351,7 +349,7 @@ static void show_mounts(char *onlytype) | |||
351 | } | 349 | } |
352 | endmntent(mountTable); | 350 | endmntent(mountTable); |
353 | } else { | 351 | } else { |
354 | perror_msg_and_die("%s", mtab_file); | 352 | bb_perror_msg_and_die(bb_path_mtab_file); |
355 | } | 353 | } |
356 | exit(EXIT_SUCCESS); | 354 | exit(EXIT_SUCCESS); |
357 | } | 355 | } |
@@ -359,7 +357,7 @@ static void show_mounts(char *onlytype) | |||
359 | extern int mount_main(int argc, char **argv) | 357 | extern int mount_main(int argc, char **argv) |
360 | { | 358 | { |
361 | struct stat statbuf; | 359 | struct stat statbuf; |
362 | char *string_flags = xstrdup(""); | 360 | char *string_flags = bb_xstrdup(""); |
363 | char *extra_opts; | 361 | char *extra_opts; |
364 | int flags = 0; | 362 | int flags = 0; |
365 | char *filesystemType = "auto"; | 363 | char *filesystemType = "auto"; |
@@ -413,7 +411,7 @@ extern int mount_main(int argc, char **argv) | |||
413 | if (optind < argc) { | 411 | if (optind < argc) { |
414 | /* if device is a filename get its real path */ | 412 | /* if device is a filename get its real path */ |
415 | if (stat(argv[optind], &statbuf) == 0) { | 413 | if (stat(argv[optind], &statbuf) == 0) { |
416 | char *tmp = simplify_path(argv[optind]); | 414 | char *tmp = bb_simplify_path(argv[optind]); |
417 | 415 | ||
418 | safe_strncpy(device, tmp, PATH_MAX); | 416 | safe_strncpy(device, tmp, PATH_MAX); |
419 | } else { | 417 | } else { |
@@ -422,13 +420,13 @@ extern int mount_main(int argc, char **argv) | |||
422 | } | 420 | } |
423 | 421 | ||
424 | if (optind + 1 < argc) | 422 | if (optind + 1 < argc) |
425 | directory = simplify_path(argv[optind + 1]); | 423 | directory = bb_simplify_path(argv[optind + 1]); |
426 | 424 | ||
427 | if (all || optind + 1 == argc) { | 425 | if (all || optind + 1 == argc) { |
428 | f = setmntent("/etc/fstab", "r"); | 426 | f = setmntent("/etc/fstab", "r"); |
429 | 427 | ||
430 | if (f == NULL) | 428 | if (f == NULL) |
431 | perror_msg_and_die("\nCannot read /etc/fstab"); | 429 | bb_perror_msg_and_die("\nCannot read /etc/fstab"); |
432 | 430 | ||
433 | while ((m = getmntent(f)) != NULL) { | 431 | while ((m = getmntent(f)) != NULL) { |
434 | if (!all && (optind + 1 == argc) | 432 | if (!all && (optind + 1 == argc) |
@@ -452,7 +450,7 @@ extern int mount_main(int argc, char **argv) | |||
452 | 450 | ||
453 | strcpy(device, m->mnt_fsname); | 451 | strcpy(device, m->mnt_fsname); |
454 | strcpy(directory, m->mnt_dir); | 452 | strcpy(directory, m->mnt_dir); |
455 | filesystemType = xstrdup(m->mnt_type); | 453 | filesystemType = bb_xstrdup(m->mnt_type); |
456 | singlemount: | 454 | singlemount: |
457 | extra_opts = string_flags; | 455 | extra_opts = string_flags; |
458 | rc = EXIT_SUCCESS; | 456 | rc = EXIT_SUCCESS; |
@@ -462,7 +460,7 @@ extern int mount_main(int argc, char **argv) | |||
462 | if (nfsmount | 460 | if (nfsmount |
463 | (device, directory, &flags, &extra_opts, &string_flags, | 461 | (device, directory, &flags, &extra_opts, &string_flags, |
464 | 1)) { | 462 | 1)) { |
465 | perror_msg("nfsmount failed"); | 463 | bb_perror_msg("nfsmount failed"); |
466 | rc = EXIT_FAILURE; | 464 | rc = EXIT_FAILURE; |
467 | } | 465 | } |
468 | } | 466 | } |