summaryrefslogtreecommitdiff
path: root/libinstaller
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-04-18 14:53:45 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-04-18 14:53:45 -0700
commit1be51e9991618732179da97750548a65371e9dff (patch)
tree5b1ed62a487d3947e025b0491157b21678764a84 /libinstaller
parent6831030abcb28fa34f63ec8d1a6304d097addb90 (diff)
parent1370ad3a91803626d326abea253f9270bd6819c3 (diff)
downloadsyslinux-1be51e9991618732179da97750548a65371e9dff.tar.gz
Merge commit 'syslinux-4.04' into dynamic-sectordynamic-sector
Diffstat (limited to 'libinstaller')
-rw-r--r--libinstaller/syslxcom.c13
-rw-r--r--libinstaller/syslxcom.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/libinstaller/syslxcom.c b/libinstaller/syslxcom.c
index b176f6d7..1de85aa5 100644
--- a/libinstaller/syslxcom.c
+++ b/libinstaller/syslxcom.c
@@ -284,3 +284,16 @@ int sectmap(int fd, sector_t *sectors, int nsectors)
return sectmap_fib(fd, sectors, nsectors);
}
+
+/*
+ * SYSLINUX installs the string 'SYSLINUX' at offset 3 in the boot
+ * sector; this is consistent with FAT filesystems. Earlier versions
+ * would install the string "EXTLINUX" instead, handle both.
+ */
+int syslinux_already_installed(int dev_fd)
+{
+ char buffer[8];
+
+ xpread(dev_fd, buffer, 8, 3);
+ return !memcmp(buffer, "SYSLINUX", 8) || !memcmp(buffer, "EXTLINUX", 8);
+}
diff --git a/libinstaller/syslxcom.h b/libinstaller/syslxcom.h
index 39ca09d3..bf186ca6 100644
--- a/libinstaller/syslxcom.h
+++ b/libinstaller/syslxcom.h
@@ -18,5 +18,6 @@ ssize_t xpwrite(int fd, const void *buf, size_t count, off_t offset);
void clear_attributes(int fd);
void set_attributes(int fd);
int sectmap(int fd, sector_t *sectors, int nsectors);
+int syslinux_already_installed(int dev_fd);
#endif