From 399365b45aae9251a57d1a0c893bf8c127e1a97a Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 10 Apr 2008 22:57:54 +0000 Subject: [PATCH] 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. --- usr.sbin/config/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index d1ca9bfa3ab9..24b439606bd2 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -150,6 +150,8 @@ main(int argc, char **argv) usage(); PREFIX = *argv; + if (stat(PREFIX, &buf) != 0 || !S_ISREG(buf.st_mode)) + err(2, "%s", PREFIX); if (freopen("DEFAULTS", "r", stdin) != NULL) { found_defaults = 1; yyfile = "DEFAULTS";