summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-04-29 18:08:07 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-04-29 18:08:07 -0400
commitfacf34bd2ffc16eb2a5e770d9be3d8010b4add42 (patch)
treeedabd39358d60e55489c0195a461323937431cba /parse.c
parent068205d5e5186ab3fb0403d129572bc90a65bd23 (diff)
downloadbfs-facf34bd2ffc16eb2a5e770d9be3d8010b4add42.tar.xz
Don't parse the mount table until it's needed
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/parse.c b/parse.c
index dde22bd..6be2e97 100644
--- a/parse.c
+++ b/parse.c
@@ -1057,9 +1057,13 @@ fail:
* Parse -fstype TYPE.
*/
static struct expr *parse_fstype(struct parser_state *state, int arg1, int arg2) {
- if (!state->cmdline->mtab) {
- cfprintf(state->cmdline->cerr, "%{er}error: %s: Couldn't parse the mount table.%{rs}\n", state->argv[0]);
- return NULL;
+ struct cmdline *cmdline = state->cmdline;
+ if (!cmdline->mtab) {
+ cmdline->mtab = parse_bfs_mtab();
+ if (!cmdline->mtab) {
+ cfprintf(cmdline->cerr, "%{er}error: Couldn't parse the mount table: %s.%{rs}\n\n", strerror(errno));
+ return NULL;
+ }
}
return parse_unary_test(state, eval_fstype);
@@ -2840,11 +2844,6 @@ struct cmdline *parse_cmdline(int argc, char *argv[]) {
goto fail;
}
- cmdline->mtab = parse_bfs_mtab();
- if (!cmdline->mtab) {
- cfprintf(cmdline->cerr, "%{wr}warning: Couldn't parse the mount table: %s.%{rs}\n\n", strerror(errno));
- }
-
struct parser_state state = {
.cmdline = cmdline,
.argv = argv + 1,