summaryrefslogtreecommitdiffstats
path: root/sbin/init
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2001-02-08 22:07:08 +0000
committerphk <phk@FreeBSD.org>2001-02-08 22:07:08 +0000
commitf8ce1eae955a47625127e4e9f1f077a6935e6520 (patch)
treeac9f340a090eca82614de61c963f5ca8a9cfd8f4 /sbin/init
parent3260df3778da194c2f65fb8f9c2fdac3897067d7 (diff)
downloadFreeBSD-src-f8ce1eae955a47625127e4e9f1f077a6935e6520.zip
FreeBSD-src-f8ce1eae955a47625127e4e9f1f077a6935e6520.tar.gz
Fix a cosmetic problem with some very defensive programming: The devfs
mount would show up as "/dev/", loose that trailing slash.
Diffstat (limited to 'sbin/init')
-rw-r--r--sbin/init/init.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 7498608..963ef2c 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -284,7 +284,23 @@ invalid:
warning("ignoring excess arguments");
if (devfs) {
- mount("devfs", _PATH_DEV, 0, 0);
+ char *s;
+ int i;
+
+ /*
+ * Try to avoid the trailing slash in _PATH_DEV.
+ * Be *very* defensive.
+ */
+ s = strdup(_PATH_DEV);
+ if (s != NULL) {
+ i = strlen(s);
+ if (i > 0 && s[i - 1] == '/')
+ s[i - 1] = '\0';
+ mount("devfs", s, 0, 0);
+ free(s);
+ } else {
+ mount("devfs", _PATH_DEV, 0, 0);
+ }
}
/*
OpenPOWER on IntegriCloud