]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsprogs-config-before-cmdline.patch
authorAndreas Dilger <adilger@sun.com>
Sat, 2 Feb 2008 08:29:25 +0000 (01:29 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 11 Feb 2008 02:58:12 +0000 (21:58 -0500)
The patch changes the order that the config file and command line are
parsed so that command line has precedence.  It also allows multiple
-E options to be specified on the command line.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
e2fsck/unix.c

index c14c70633ee78dbbb55ef570f4ea0e6eecc4b627..8116ef6a76975ee03ec8abd889a88b91bd2538f4 100644 (file)
@@ -588,7 +588,6 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 #ifdef HAVE_SIGNAL_H
        struct sigaction        sa;
 #endif
-       char            *extended_opts = 0;
        char            *cp;
        int             res;            /* result of sscanf */
 #ifdef CONFIG_JBD_DEBUG
@@ -619,6 +618,12 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                ctx->program_name = *argv;
        else
                ctx->program_name = "e2fsck";
+
+       if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
+               config_fn[0] = cp;
+       profile_set_syntax_err_cb(syntax_err_report);
+       profile_init(config_fn, &ctx->profile);
+
        while ((c = getopt (argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDk")) != EOF)
                switch (c) {
                case 'C':
@@ -645,7 +650,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        ctx->options |= E2F_OPT_COMPRESS_DIRS;
                        break;
                case 'E':
-                       extended_opts = optarg;
+                       parse_extended_opts(ctx, optarg);
                        break;
                case 'p':
                case 'a':
@@ -771,13 +776,6 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        argv[optind]);
                fatal_error(ctx, 0);
        }
-       if (extended_opts)
-               parse_extended_opts(ctx, extended_opts);
-
-       if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
-               config_fn[0] = cp;
-       profile_set_syntax_err_cb(syntax_err_report);
-       profile_init(config_fn, &ctx->profile);
 
        if (flush) {
                fd = open(ctx->filesystem_name, O_RDONLY, 0);