Fix a bug introduced by DEFAULTS feature. When the config file

doesn't exist, we make a directory and then say "oops, that file isn't
there" leaving the directory behind.  Add a stat for the config file
so that we detect this before making the directory.  This is
semi-lame, but less lame than having this bug.
This commit is contained in:
imp 2008-04-10 22:57:54 +00:00
parent 76d5b2344b
commit 399365b45a

View File

@ -150,6 +150,8 @@ main(int argc, char **argv)
usage(); usage();
PREFIX = *argv; PREFIX = *argv;
if (stat(PREFIX, &buf) != 0 || !S_ISREG(buf.st_mode))
err(2, "%s", PREFIX);
if (freopen("DEFAULTS", "r", stdin) != NULL) { if (freopen("DEFAULTS", "r", stdin) != NULL) {
found_defaults = 1; found_defaults = 1;
yyfile = "DEFAULTS"; yyfile = "DEFAULTS";