From d99d951c1c77a9727f83ca99c52261cc3bc93f76 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 10 Apr 2008 22:57:54 +0000 Subject: 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(+) (limited to 'usr.sbin/config/main.c') diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index d1ca9bf..24b4396 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"; -- cgit v1.1