From: Paulo Alcantara Date: Tue, 22 Jan 2013 19:12:51 +0000 (-0200) Subject: extlinux: Also install ldlinux.c32 file on XFS X-Git-Tag: syslinux-5.01-pre5~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=129a5845aec4d6c750c4bddd936f315fb441d2fa;p=platform%2Fupstream%2Fsyslinux.git extlinux: Also install ldlinux.c32 file on XFS Signed-off-by: Paulo Alcantara --- 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: