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:
Theodore Ts'o 1998-08-26 15:23:31 +00:00
parent e7549ca628
commit 24fc5032b5
2 changed files with 24 additions and 3 deletions

View File

@ -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

View File

@ -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,7 +468,8 @@ 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);
#endif