aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1994-09-06 20:04:39 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1994-09-06 20:04:39 +0000
commitc33f35354b20387ed10538c3b732c32f18f237bd (patch)
tree9b3d6c2e6e8180ba28820f5da68fe2d0709b3c2a /usr.sbin/config
parentdb141545dcc556eb295ec3aa594937a488c2be5c (diff)
downloadsrc-c33f35354b20387ed10538c3b732c32f18f237bd.tar.gz
src-c33f35354b20387ed10538c3b732c32f18f237bd.zip
Revert back to old config behavior if compiled with -DCONFIG_DONT_CLOBBER.
Notes
Notes: svn path=/head/; revision=2525
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/Makefile3
-rw-r--r--usr.sbin/config/main.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/usr.sbin/config/Makefile b/usr.sbin/config/Makefile
index 94493d96ab28..d59ea402a8c0 100644
--- a/usr.sbin/config/Makefile
+++ b/usr.sbin/config/Makefile
@@ -2,6 +2,9 @@
PROG= config
CFLAGS+=-I. -I${.CURDIR} -DSTATCLOCK
+.if defined(CONFIG_DONT_CLOBBER)
+CFLAGS+= -DCONFIG_DONT_CLOBBER
+.endif
SRCS= config.c main.c lang.c mkioconf.c mkmakefile.c mkglue.c mkheaders.c \
mkswapconf.c
MAN8= config.8
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index ae7692e92e7e..a54797f35af0 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -90,8 +90,12 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(PREFIX);
exit(2);
}
+#ifndef CONFIG_DONT_CLOBBER
+ if (stat(p = path((char *)NULL), &buf)) {
+#else /* CONFIG_DONT_CLOBBER */
p = path((char *)NULL);
if (stat(p, &buf)) {
+#endif /* CONFIG_DONT_CLOBBER */
if (mkdir(p, 0777)) {
perror(p);
exit(2);
@@ -100,6 +104,7 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
else if ((buf.st_mode & S_IFMT) != S_IFDIR) {
fprintf(stderr, "config: %s isn't a directory.\n", p);
exit(2);
+#ifdef CONFIG_DONT_CLOBBER
}
else {
char tmp[strlen(p) + 8];
@@ -117,6 +122,7 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(p);
exit(2);
}
+#endif /* CONFIG_DONT_CLOBBER */
}
loadaddress = -1;