From 6936782c19ccb1aef7bb14a310fdd933f4eef7d3 Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Thu, 22 Apr 2010 10:43:24 +0200 Subject: loader: strip trailing slash character from stage2= URL. previously, the URL could only be "*.img" anyway. If we are going to be mounting directories, let's have the URL in the same form all the time. --- loader/method.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'loader') diff --git a/loader/method.c b/loader/method.c index d6f83e633..1937b5a3e 100644 --- a/loader/method.c +++ b/loader/method.c @@ -59,6 +59,15 @@ /* boot flags */ extern uint64_t flags; +static void stripTrailingSlash(char *path) { + size_t len = strlen(path); + + if (len == 0) + return; + if (path[len-1] == '/') + path[len-1] = '\0'; +} + int umountLoopback(char * mntpoint, char * device) { int loopfd; @@ -508,6 +517,7 @@ void setStage2LocFromCmdline(char * arg, struct loaderData_s * ld) { &(((struct nfsInstallData *)ld->stage2Data)->host), &(((struct nfsInstallData *)ld->stage2Data)->directory), &(((struct nfsInstallData *)ld->stage2Data)->mountOpts)); + stripTrailingSlash(((struct nfsInstallData *)ld->stage2Data)->directory); } else if (!strncmp(arg, "nfsiso:", 7)) { ld->method = METHOD_NFS; ld->stage2Data = calloc(sizeof(struct nfsInstallData *), 1); -- cgit