mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2025-01-12 11:33:24 +08:00
ChangeLog, unix.c:
unix.c (check_if_skip): Move the "not cleanly mounted" check ahead of the maximal mount and too long since checked tests. (reserve_stdio_fds): Make sure 0,1,2 file descriptors are open, so that we don't open the filesystem using the same file descriptor as stdout or stderr.
This commit is contained in:
parent
e7549ca628
commit
24fc5032b5
@ -1,3 +1,11 @@
|
||||
1998-08-17 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* unix.c (check_if_skip): Move the "not cleanly mounted" check
|
||||
ahead of the maximal mount and too long since checked tests.
|
||||
(reserve_stdio_fds): Make sure 0,1,2 file descriptors are
|
||||
open, so that we don't open the filesystem using the same
|
||||
file descriptor as stdout or stderr.
|
||||
|
||||
1998-08-01 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* pass2.c (e2fsck_pass2): Fix the progress accounting so that we
|
||||
|
@ -198,6 +198,8 @@ static void check_if_skip(e2fsck_t ctx)
|
||||
|
||||
if (fs->super->s_state & EXT2_ERROR_FS)
|
||||
reason = "contains a file system with errors";
|
||||
else if ((fs->super->s_state & EXT2_VALID_FS) == 0)
|
||||
reason = "was not cleanly unmounted";
|
||||
else if (fs->super->s_mnt_count >=
|
||||
(unsigned) fs->super->s_max_mnt_count)
|
||||
reason = "has reached maximal mount count";
|
||||
@ -205,8 +207,6 @@ static void check_if_skip(e2fsck_t ctx)
|
||||
time(0) >= (fs->super->s_lastcheck +
|
||||
fs->super->s_checkinterval))
|
||||
reason = "has gone too long without being checked";
|
||||
else if ((fs->super->s_state & EXT2_VALID_FS) == 0)
|
||||
reason = "was not cleanly unmounted";
|
||||
if (reason) {
|
||||
printf("%s %s, check forced.\n", ctx->device_name, reason);
|
||||
return;
|
||||
@ -246,6 +246,18 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass,
|
||||
|
||||
#define PATH_SET "PATH=/sbin"
|
||||
|
||||
static void reserve_stdio_fds(NOARGS)
|
||||
{
|
||||
int fd;
|
||||
|
||||
while (1) {
|
||||
fd = open("/dev/null", O_RDWR);
|
||||
if (fd > 2)
|
||||
break;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||
{
|
||||
int flush = 0;
|
||||
@ -456,6 +468,7 @@ int main (int argc, char *argv[])
|
||||
"while trying to initialize program");
|
||||
exit(1);
|
||||
}
|
||||
reserve_stdio_fds();
|
||||
|
||||
#ifdef RESOURCE_TRACK
|
||||
init_resource_track(&ctx->global_rtrack);
|
||||
|
Loading…
Reference in New Issue
Block a user