aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2005-12-31 00:00:10 -0500
committerTheodore Ts'o <tytso@mit.edu>2005-12-31 00:00:10 -0500
commit1017f65179f4aa313f699109b471b79f99f38d3d (patch)
treeeede46ffcf8ed92cfda517bdb75b5bc068a139e3
parent2fa9ba98337b07d6acfac52b5ee5dc8116dda866 (diff)
downloade2fsprogs-1017f65179f4aa313f699109b471b79f99f38d3d.tar.gz
e2fsprogs-1017f65179f4aa313f699109b471b79f99f38d3d.tar.xz
e2fsprogs-1017f65179f4aa313f699109b471b79f99f38d3d.zip
Read in /etc/e2fsck.conf configuration file at startup
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--e2fsck/ChangeLog4
-rw-r--r--e2fsck/e2fsck.c3
-rw-r--r--e2fsck/e2fsck.h5
-rw-r--r--e2fsck/unix.c6
4 files changed, 17 insertions, 1 deletions
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 3e7d76d2..9b9b8be5 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,9 @@
2005-12-30 Theodore Ts'o <tytso@mit.edu>
+ * e2fsck.c (e2fsck_free_context), unix.c (PRS), e2fsck.h: Use
+ the profile library to read in the /etc/e2fsck.conf file
+ at startup.
+
* profile.c, profile.h, prof_err.et: Add the profile library code
to e2fsck. The profile library was originally written by
Theodore Ts'o in 1995 for use in the MIT Kerberos v5
diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c
index 7d2ccf62..2ba72c89 100644
--- a/e2fsck/e2fsck.c
+++ b/e2fsck/e2fsck.c
@@ -165,6 +165,9 @@ void e2fsck_free_context(e2fsck_t ctx)
e2fsck_reset_context(ctx);
if (ctx->blkid)
blkid_put_cache(ctx->blkid);
+
+ if (ctx->profile)
+ profile_release(ctx->profile);
ext2fs_free_mem(&ctx);
}
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 898b9a3c..be7899ff 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -33,6 +33,9 @@
#include "blkid/blkid.h"
#endif
+#include "profile.h"
+#include "prof_err.h"
+
#ifdef ENABLE_NLS
#include <libintl.h>
#include <locale.h>
@@ -326,6 +329,8 @@ struct e2fsck_struct {
int ext_attr_ver;
+ profile_t profile;
+
/*
* For the use of callers of the e2fsck functions; not used by
* e2fsck functions themselves.
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 63d355e7..024e4342 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -548,6 +548,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
}
}
+static const char *config_fn[] = { "/etc/e2fsck.conf", 0 };
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
{
@@ -580,6 +581,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
memset(bar, '=', sizeof(bar)-1);
memset(spaces, ' ', sizeof(spaces)-1);
initialize_ext2_error_table();
+ initialize_prof_error_table();
blkid_get_cache(&ctx->blkid, NULL);
if (argc && *argv)
@@ -731,7 +733,9 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
}
if (extended_opts)
parse_extended_opts(ctx, extended_opts);
-
+
+ profile_init(config_fn, &ctx->profile);
+
if (flush) {
fd = open(ctx->filesystem_name, O_RDONLY, 0);
if (fd < 0) {