+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
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";
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;
#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;
"while trying to initialize program");
exit(1);
}
-
+ reserve_stdio_fds();
+
#ifdef RESOURCE_TRACK
init_resource_track(&ctx->global_rtrack);
#endif