summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-07-06 10:43:42 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-07-06 10:43:42 -0700
commitdfdfec6e416896fe2800b58ef3e14e648033c67a (patch)
tree52b4c17ec623739b68f7f822dde89e9a3dc394d8
parent17125e545a43ef8dbae6347557cdf46a89a8f63b (diff)
parentc2d4f9b611c43697e889d991d8a4edea92ef2d76 (diff)
downloadsyslinux-4.10-pre16.tar.gz
Merge remote-tracking branch 'origin/master' into lwipsyslinux-4.10-pre16
-rwxr-xr-xextlinux/main.c4
-rw-r--r--libinstaller/syslxint.h9
-rw-r--r--utils/isohybrid.c19
-rw-r--r--utils/isohybrid.h2
4 files changed, 24 insertions, 10 deletions
diff --git a/extlinux/main.c b/extlinux/main.c
index 6aa6202d..26dba7ba 100755
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -347,9 +347,7 @@ int install_bootblock(int fd, const char *device)
perror("reading fat superblock");
return 1;
}
- if (sb3.bsResSectors && sb3.bsFATs &&
- (strstr(sb3.bs16.FileSysType, "FAT") ||
- strstr(sb3.bs32.FileSysType, "FAT")))
+ if (fat_check_sb_fields(&sb3))
ok = true;
}
if (!ok) {
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index 80c40f76..7c9da516 100644
--- a/libinstaller/syslxint.h
+++ b/libinstaller/syslxint.h
@@ -247,4 +247,13 @@ struct boot_sector {
#define bsCodeLen (offsetof(struct boot_sector, bsSignature) - \
offsetof(struct boot_sector, bsCode))
+static inline int fat_check_sb_fields(const struct boot_sector *sb)
+{
+ return sb->bsResSectors && sb->bsFATs &&
+ (!memcmp(sb->bs16.FileSysType, "FAT12 ", 8) ||
+ !memcmp(sb->bs16.FileSysType, "FAT16 ", 8) ||
+ !memcmp(sb->bs16.FileSysType, "FAT ", 8) ||
+ !memcmp(sb->bs32.FileSysType, "FAT32 ", 8));
+}
+
#endif /* SYSLXINT_H */
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
index 7ee9a7f0..8a605313 100644
--- a/utils/isohybrid.c
+++ b/utils/isohybrid.c
@@ -108,6 +108,7 @@ printh(void)
int
check_option(int argc, char *argv[])
{
+ char *err = NULL;
int n = 0, ind = 0;
const char optstr[] = ":h:s:e:o:t:i:fcp?vV";
@@ -135,32 +136,38 @@ check_option(int argc, char *argv[])
switch (n)
{
case 'h':
- if (!sscanf(optarg, "%hu", &head) || head < 1 || head > 256)
+ head = strtoul(optarg, &err, 0);
+ if (head < 1 || head > 256)
errx(1, "invalid head: `%s', 1 <= head <= 256", optarg);
break;
case 's':
- if (!sscanf(optarg, "%hhu", &sector) || sector < 1 || sector > 63)
+ sector = strtoul(optarg, &err, 0);
+ if (sector < 1 || sector > 63)
errx(1, "invalid sector: `%s', 1 <= sector <= 63", optarg);
break;
case 'e':
- if (!sscanf(optarg, "%hhu", &entry) || entry < 1 || entry > 4)
+ entry = strtoul(optarg, &err, 0);
+ if (entry < 1 || entry > 4)
errx(1, "invalid entry: `%s', 1 <= entry <= 4", optarg);
break;
case 'o':
- if (!sscanf(optarg, "%hhu", &offset) || offset > 64)
+ offset = strtoul(optarg, &err, 0);
+ if (*err || offset > 64)
errx(1, "invalid offset: `%s', 0 <= offset <= 64", optarg);
break;
case 't':
- if (!sscanf(optarg, "%hu", &type) || type > 255)
+ type = strtoul(optarg, &err, 0);
+ if (*err || type > 255)
errx(1, "invalid type: `%s', 0 <= type <= 255", optarg);
break;
case 'i':
- if (!sscanf(optarg, "%u", &id))
+ id = strtoul(optarg, &err, 0);
+ if (*err)
errx(1, "invalid id: `%s'", optarg);
break;
diff --git a/utils/isohybrid.h b/utils/isohybrid.h
index 826e90c5..eecf1caa 100644
--- a/utils/isohybrid.h
+++ b/utils/isohybrid.h
@@ -20,7 +20,7 @@
*
*/
-#define VERSION "0.11"
+#define VERSION "0.12"
#define BUFSIZE 2048
#define MBRSIZE 432