diff options
author | Paulo Alcantara <pcacjr@zytor.com> | 2013-01-22 17:12:51 -0200 |
---|---|---|
committer | Paulo Alcantara <pcacjr@zytor.com> | 2013-01-22 17:26:41 -0200 |
commit | 129a5845aec4d6c750c4bddd936f315fb441d2fa (patch) | |
tree | f75d98788a5537ab5124c1b0f4788c4079064ea2 | |
parent | 8656549bab437d880ab4a485b40b6f806182efbd (diff) | |
download | syslinux-129a5845aec4d6c750c4bddd936f315fb441d2fa.tar.gz syslinux-129a5845aec4d6c750c4bddd936f315fb441d2fa.tar.xz syslinux-129a5845aec4d6c750c4bddd936f315fb441d2fa.zip |
extlinux: Also install ldlinux.c32 file on XFS
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
-rw-r--r-- | extlinux/main.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/extlinux/main.c b/extlinux/main.c index 01bfc9c4..aa20e1bd 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -644,12 +644,16 @@ int btrfs_install_file(const char *path, int devfd, struct stat *rst) */ static int xfs_install_file(const char *path, int devfd, struct stat *rst) { - static char file[PATH_MAX]; + static char file[PATH_MAX + 1]; + static char c32file[PATH_MAX + 1]; int dirfd = -1; int fd = -1; + int retval; - snprintf(file, PATH_MAX, "%s%sldlinux.sys", - path, path[0] && path[strlen(path) - 1] == '/' ? "" : "/"); + snprintf(file, PATH_MAX + 1, "%s%sldlinux.sys", path, + path[0] && path[strlen(path) - 1] == '/' ? "" : "/"); + snprintf(c32file, PATH_MAX + 1, "%s%sldlinux.c32", path, + path[0] && path[strlen(path) - 1] == '/' ? "" : "/"); dirfd = open(path, O_RDONLY | O_DIRECTORY); if (dirfd < 0) { @@ -683,10 +687,28 @@ static int xfs_install_file(const char *path, int devfd, struct stat *rst) } close(dirfd); + close(fd); + + dirfd = -1; + fd = -1; + + fd = open(c32file, O_WRONLY | O_TRUNC | O_CREAT | O_SYNC, + S_IRUSR | S_IRGRP | S_IROTH); + if (fd < 0) { + perror(c32file); + goto bail; + } + + retval = xpwrite(fd, syslinux_ldlinuxc32, syslinux_ldlinuxc32_len, 0); + if (retval != (int)syslinux_ldlinuxc32_len) { + fprintf(stderr, "%s: write failure on %s\n", program, file); + goto bail; + } - sync(); close(fd); + sync(); + return 0; bail: |