[syslinux:elflink] extlinux: Also install ldlinux.c32 file on XFS
syslinux-bot for Paulo Alcantara
pcacjr at zytor.com
Thu Jan 24 09:45:08 PST 2013
Commit-ID: 129a5845aec4d6c750c4bddd936f315fb441d2fa
Gitweb: http://www.syslinux.org/commit/129a5845aec4d6c750c4bddd936f315fb441d2fa
Author: Paulo Alcantara <pcacjr at zytor.com>
AuthorDate: Tue, 22 Jan 2013 17:12:51 -0200
Committer: Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Tue, 22 Jan 2013 17:26:41 -0200
extlinux: Also install ldlinux.c32 file on XFS
Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>
---
extlinux/main.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/extlinux/main.c b/extlinux/main.c
index 01bfc9c..aa20e1b 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:
More information about the Syslinux-commits
mailing list