diff options
| author | Craig Rodrigues <rodrigc@FreeBSD.org> | 2009-06-01 01:02:30 +0000 |
|---|---|---|
| committer | Craig Rodrigues <rodrigc@FreeBSD.org> | 2009-06-01 01:02:30 +0000 |
| commit | 0c349f0856fb3fa3e73f67639e578f789e30145b (patch) | |
| tree | 74e51078ec3549432e91cb91eaba5a7e13cebe39 /sys/boot/common | |
| parent | 31438685ec699ad97cdbf442d722a68b6d8b5aee (diff) | |
Notes
Diffstat (limited to 'sys/boot/common')
| -rw-r--r-- | sys/boot/common/boot.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c index 515d0fa1f4a0..315c039b4666 100644 --- a/sys/boot/common/boot.c +++ b/sys/boot/common/boot.c @@ -287,7 +287,7 @@ getbootfile(int try) int getrootmount(char *rootdev) { - char lbuf[128], *cp, *ep, *dev, *fstyp; + char lbuf[128], *cp, *ep, *dev, *fstyp, *options; int fd, error; if (getenv("vfs.root.mountfrom") != NULL) @@ -331,11 +331,30 @@ getrootmount(char *rootdev) *cp = 0; fstyp = strdup(ep); - /* build the final result and save it */ + /* skip whitespace up to mount options */ + cp += 1; + while ((*cp != 0) && isspace(*cp)) + cp++; + if (*cp == 0) /* misformatted */ + continue; + /* skip text to end of mount options and delimit */ + ep = cp; + while ((*cp != 0) && !isspace(*cp)) + cp++; + *cp = 0; + options = strdup(ep); + /* Build the <fstype>:<device> and save it in vfs.root.mountfrom */ sprintf(lbuf, "%s:%s", fstyp, dev); free(dev); free(fstyp); setenv("vfs.root.mountfrom", lbuf, 0); + + /* Don't override vfs.root.mountfrom.options if it is already set */ + if (getenv("vfs.root.mountfrom.options") == NULL) { + /* save mount options */ + setenv("vfs.root.mountfrom.options", options, 0); + } + free(options); error = 0; break; } |
