summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorAles Kozumplik <akozumpl@redhat.com>2010-04-22 10:43:24 +0200
committerAles Kozumplik <akozumpl@redhat.com>2010-04-23 14:45:23 +0200
commit6936782c19ccb1aef7bb14a310fdd933f4eef7d3 (patch)
tree79874ed09ce354ad4fcb3c3ff6a31de89b56e2cc /loader
parent0a4ae74b585ff404a120ca3d572a190a4334cbb1 (diff)
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.
Diffstat (limited to 'loader')
-rw-r--r--loader/method.c10
1 files changed, 10 insertions, 0 deletions
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);