diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-05 04:50:36 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-05 04:50:36 +0200 |
commit | 09e63bb81f12707d31c8c4570931af0196b53a46 (patch) | |
tree | 1b550ca677e6cd4fdd70eabda1fd402684b8ec7d /util-linux/fsck_minix.c | |
parent | 9b1b62adc4e4c1e80d9f72180c6b7b1eaef9f95a (diff) | |
download | busybox-w32-09e63bb81f12707d31c8c4570931af0196b53a46.tar.gz busybox-w32-09e63bb81f12707d31c8c4570931af0196b53a46.tar.bz2 busybox-w32-09e63bb81f12707d31c8c4570931af0196b53a46.zip |
df: fix "df /"
also, clean up mount checks in mkfs/fsck.
function old new delta
find_mount_point 243 261 +18
sha1_process_block64 497 510 +13
find_main 436 444 +8
display_speed 85 90 +5
df_main 795 793 -2
parse_command 1463 1460 -3
static.ignored_mounts 8 - -8
mkfs_minix_main 2962 2937 -25
fsck_minix_main 3065 2970 -95
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/4 up/down: 44/-133) Total: -89 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/fsck_minix.c')
-rw-r--r-- | util-linux/fsck_minix.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 0c33c1b02..ca0b17efe 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -374,38 +374,28 @@ static int ask(const char *string, int def) | |||
374 | */ | 374 | */ |
375 | static void check_mount(void) | 375 | static void check_mount(void) |
376 | { | 376 | { |
377 | FILE *f; | 377 | if (find_mount_point(device_name)) { |
378 | struct mntent *mnt; | 378 | int cont; |
379 | int cont; | 379 | #if ENABLE_FEATURE_MTAB_SUPPORT |
380 | int fd; | 380 | /* |
381 | //XXX:FIXME use find_mount_point() | 381 | * If the root is mounted read-only, then /etc/mtab is |
382 | f = setmntent(MOUNTED, "r"); | 382 | * probably not correct; so we won't issue a warning based on |
383 | if (f == NULL) | 383 | * it. |
384 | return; | 384 | */ |
385 | while ((mnt = getmntent(f)) != NULL) | 385 | int fd = open(bb_path_mtab_file, O_RDWR); |
386 | if (strcmp(device_name, mnt->mnt_fsname) == 0) | 386 | |
387 | break; | 387 | if (fd < 0 && errno == EROFS) |
388 | endmntent(f); | 388 | return; |
389 | if (!mnt) | 389 | close(fd); |
390 | return; | 390 | #endif |
391 | 391 | printf("%s is mounted. ", device_name); | |
392 | /* | 392 | cont = 0; |
393 | * If the root is mounted read-only, then /etc/mtab is | 393 | if (isatty(0) && isatty(1)) |
394 | * probably not correct; so we won't issue a warning based on | 394 | cont = ask("Do you really want to continue", 0); |
395 | * it. | 395 | if (!cont) { |
396 | */ | 396 | printf("Check aborted\n"); |
397 | fd = open(MOUNTED, O_RDWR); | 397 | exit(EXIT_SUCCESS); |
398 | if (fd < 0 && errno == EROFS) | 398 | } |
399 | return; | ||
400 | close(fd); | ||
401 | |||
402 | printf("%s is mounted. ", device_name); | ||
403 | cont = 0; | ||
404 | if (isatty(0) && isatty(1)) | ||
405 | cont = ask("Do you really want to continue", 0); | ||
406 | if (!cont) { | ||
407 | printf("Check aborted\n"); | ||
408 | exit(EXIT_SUCCESS); | ||
409 | } | 399 | } |
410 | } | 400 | } |
411 | 401 | ||