summaryrefslogtreecommitdiff
path: root/e2fsck
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsck')
-rw-r--r--e2fsck/e2fsck.8.in11
-rw-r--r--e2fsck/unix.c19
2 files changed, 18 insertions, 12 deletions
diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in
index a9701736..3fb15e6d 100644
--- a/e2fsck/e2fsck.8.in
+++ b/e2fsck/e2fsck.8.in
@@ -242,16 +242,7 @@ in the file are added to the bad blocks list.)
Open the filesystem read-only, and assume an answer of `no' to all
questions. Allows
.B e2fsck
-to be used non-interactively. (Note: if the
-.BR \-c ,
-.BR \-l ,
-or
-.B \-L
-options are specified in addition to the
-.B \-n
-option, then the filesystem will be opened read-write, to permit the
-bad-blocks list to be updated. However, no other changes will be made
-to the filesystem.) This option
+to be used non-interactively. This option
may not be specified at the same time as the
.B \-p
or
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 62489580..49e90085 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -789,8 +789,23 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
return 0;
if (optind != argc - 1)
usage(ctx);
- if ((ctx->options & E2F_OPT_NO) && !bad_blocks_file &&
- !cflag && !(ctx->options & E2F_OPT_COMPRESS_DIRS))
+ if ((ctx->options & E2F_OPT_NO) &&
+ (ctx->options & E2F_OPT_COMPRESS_DIRS)) {
+ com_err(ctx->program_name, 0,
+ _("The -n and -D options are incompatible."));
+ fatal_error(ctx, 0);
+ }
+ if ((ctx->options & E2F_OPT_NO) && cflag) {
+ com_err(ctx->program_name, 0,
+ _("The -n and -c options are incompatible."));
+ fatal_error(ctx, 0);
+ }
+ if ((ctx->options & E2F_OPT_NO) && bad_blocks_file) {
+ com_err(ctx->program_name, 0,
+ _("The -n and -l/-L options are incompatible."));
+ fatal_error(ctx, 0);
+ }
+ if (ctx->options & E2F_OPT_NO)
ctx->options |= E2F_OPT_READONLY;
ctx->io_options = strchr(argv[optind], '?');