aboutsummaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-09 18:38:38 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-09 18:38:38 -0700
commitb0ff6613d593ee88790a9299afd20ebd66c65b3c (patch)
tree029fd1bc936653be6e218ad3e9229af1e5264efb /linux
parentd9408bb55f2c833de361cef1153c615d2874e7c6 (diff)
downloadsyslinux-b0ff6613d593ee88790a9299afd20ebd66c65b3c.tar.gz
syslinux-b0ff6613d593ee88790a9299afd20ebd66c65b3c.tar.xz
syslinux-b0ff6613d593ee88790a9299afd20ebd66c65b3c.zip
syslinux: Correctly handle the case of installing into the root
When installing into the root directory, we should logically search the root directory first. Thus, we need to make sure the current path is "/" not "". Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'linux')
-rw-r--r--linux/syslinux.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/linux/syslinux.c b/linux/syslinux.c
index d8b31491..d6a5d834 100644
--- a/linux/syslinux.c
+++ b/linux/syslinux.c
@@ -276,7 +276,7 @@ int main(int argc, char *argv[])
char mntname[128];
char *ldlinux_name;
char *ldlinux_path;
- const char *subdir;
+ char *subdir;
uint32_t *sectors = NULL;
int ldlinux_sectors = (boot_image_len + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
const char *errmsg;
@@ -288,7 +288,12 @@ int main(int argc, char *argv[])
umask(077);
parse_options(argc, argv, MODE_SYSLINUX);
- subdir = opt.directory;
+ asprintf(&subdir, "%s%s",
+ opt.directory[0] == '/' ? "" : "/", opt.directory);
+ if (!subdir) {
+ perror(program);
+ exit(1);
+ }
if (!opt.device)
usage(EX_USAGE, MODE_SYSLINUX);