summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1994-09-03 21:23:36 +0000
committerjkh <jkh@FreeBSD.org>1994-09-03 21:23:36 +0000
commit010d228ad6975af67848079ecbeca590d3ac7ed1 (patch)
tree1c216b7dc5a28910f1874ecce649b4ccc3b71392 /usr.sbin/config
parent3a7fc439eab11f15ff9ad4e70de163aacc2cb95b (diff)
downloadFreeBSD-src-010d228ad6975af67848079ecbeca590d3ac7ed1.zip
FreeBSD-src-010d228ad6975af67848079ecbeca590d3ac7ed1.tar.gz
Eradicate my #1 (ok, maybe #2) peeve by making config now blow away
and recreate any previous ../../compile/<blah> directory before laying down new files. The depends just aren't smart enough to save us from the grief that config's old behavior has always caused. Submitted by: jkh
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/main.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 372e17d..ae7692e 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -90,7 +90,8 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(PREFIX);
exit(2);
}
- if (stat(p = path((char *)NULL), &buf)) {
+ p = path((char *)NULL);
+ if (stat(p, &buf)) {
if (mkdir(p, 0777)) {
perror(p);
exit(2);
@@ -100,6 +101,23 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
fprintf(stderr, "config: %s isn't a directory.\n", p);
exit(2);
}
+ else {
+ char tmp[strlen(p) + 8];
+
+ fprintf(stderr, "Removing old directory %s: ", p);
+ fflush(stderr);
+ sprintf(tmp, "rm -rf %s", p);
+ if (system(tmp)) {
+ fprintf(stderr, "Failed!\n");
+ perror(tmp);
+ exit(2);
+ }
+ fprintf(stderr, "Done.\n");
+ if (mkdir(p, 0777)) {
+ perror(p);
+ exit(2);
+ }
+ }
loadaddress = -1;
dtab = NULL;
OpenPOWER on IntegriCloud