From: Theodore Ts'o Date: Thu, 2 Jan 2003 21:36:44 +0000 (-0500) Subject: Print an error if more than one of the -p/-a, -n or -y options X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8161a7484f47f12e562080a1312a4db9d2f71b40;p=tools%2Fe2fsprogs.git Print an error if more than one of the -p/-a, -n or -y options are passed to e2fsck. --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 83a7b49..86c74cb 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,8 @@ +2003-11-19 Theodore Ts'o + + * unix.c (PRS): Print an error if more than one of the -p/-a, -n + or -y options are specified. + 2002-11-12 Theodore Ts'o * problem.c: Make HTREE problems PR_PREEN_OK, so that we don't diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 96fe4f3..819352c 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -560,16 +560,22 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) break; case 'p': case 'a': + if (ctx->options & (E2F_OPT_YES|E2F_OPT_NO)) { + conflict_opt: + fatal_error(ctx, + _("Only one the options -p/-a, -n or -y may be specified.")); + } ctx->options |= E2F_OPT_PREEN; - ctx->options &= ~(E2F_OPT_YES|E2F_OPT_NO); break; case 'n': + if (ctx->options & (E2F_OPT_YES|E2F_OPT_PREEN)) + goto conflict_opt; ctx->options |= E2F_OPT_NO; - ctx->options &= ~(E2F_OPT_YES|E2F_OPT_PREEN); break; case 'y': + if (ctx->options & (E2F_OPT_PREEN|E2F_OPT_NO)) + goto conflict_opt; ctx->options |= E2F_OPT_YES; - ctx->options &= ~(E2F_OPT_PREEN|E2F_OPT_NO); break; case 't': #ifdef RESOURCE_TRACK