diff options
author | imp <imp@FreeBSD.org> | 2008-04-10 22:57:54 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2008-04-10 22:57:54 +0000 |
commit | d99d951c1c77a9727f83ca99c52261cc3bc93f76 (patch) | |
tree | 3911b7c1e1d1ff2441376fc9e55b222f660cf5de /usr.sbin | |
parent | 071467d40e7057d32312cd63f581babfad08b950 (diff) | |
download | FreeBSD-src-d99d951c1c77a9727f83ca99c52261cc3bc93f76.zip FreeBSD-src-d99d951c1c77a9727f83ca99c52261cc3bc93f76.tar.gz |
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/config/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
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"; |