From 421b0201edb0f122cdfbd4f5816aebbf092e3034 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Thu, 8 Feb 2001 22:07:08 +0000 Subject: [PATCH] Fix a cosmetic problem with some very defensive programming: The devfs mount would show up as "/dev/", loose that trailing slash. --- sbin/init/init.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 7498608b388a..963ef2cfb597 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -284,7 +284,23 @@ main(argc, argv) 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); + } } /*