diff options
author | peter <peter@FreeBSD.org> | 2005-11-29 22:54:49 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2005-11-29 22:54:49 +0000 |
commit | bf85e6f24581fb7ed9092f663ae000d45cf5cd1c (patch) | |
tree | 207149ce0560c235a8700c3fdc949b619a42a6e1 | |
parent | a171173570b69816d25bed8c87e298cba5b0aab0 (diff) | |
download | FreeBSD-src-bf85e6f24581fb7ed9092f663ae000d45cf5cd1c.zip FreeBSD-src-bf85e6f24581fb7ed9092f663ae000d45cf5cd1c.tar.gz |
The DEFAULTS changes caused the user specified config file to be opened
much later than before, and it is now after we do a mkdir ../compile/FILE.
As a result, if you do 'config DOESNOTEXIST', it now creates the directory
../config/DOESNOTEXIST. It did not do that before. If DEFAULTS does not
exist, it still fails early before any permanent changes.
This shameless hack restores the old behavior of ensuring the config file
actually exists before mkdiring its counterpart directory.
Now I can rmdir ../compile/D and it will stay dead, after my fingers keep
sabotaging me with 'config D<tab><enter>'. (Some of my kernel names
started with D, which used to be 1-character unique and my fingers knew
this very well...)
-rw-r--r-- | usr.sbin/config/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 3ff1575..0ab79c3 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -96,6 +96,7 @@ main(int argc, char **argv) int ch, len; char *p; char xxx[MAXPATHLEN]; + FILE *fp; while ((ch = getopt(argc, argv, "d:gpV")) != -1) switch (ch) { @@ -125,6 +126,10 @@ main(int argc, char **argv) usage(); PREFIX = *argv; + fp = fopen(PREFIX, "r"); + if (fp == NULL) + err(2, "%s", PREFIX); + fclose(fp); if (freopen("DEFAULTS", "r", stdin) != NULL) { found_defaults = 1; yyfile = "DEFAULTS"; |