diff options
author | hpa <hpa> | 2005-03-08 18:39:32 +0000 |
---|---|---|
committer | hpa <hpa> | 2005-03-08 18:39:32 +0000 |
commit | c19f90a3e55888fa7ff6f6022fc69465e952e99d (patch) | |
tree | 87bd1210e839787cccdaafb50e6a84e58e180964 /memdisk | |
parent | d59d2c187dac7a3d632293af16ff690e7a38dbc0 (diff) | |
download | syslinux-c19f90a3e55888fa7ff6f6022fc69465e952e99d.tar.gz |
Actually use memcmp() for the DOSEMU comparison; we can't seem to get
it right any other way...
Diffstat (limited to 'memdisk')
-rw-r--r-- | memdisk/memdisk.h | 17 | ||||
-rw-r--r-- | memdisk/setup.c | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/memdisk/memdisk.h b/memdisk/memdisk.h index 68a92d39..f7283886 100644 --- a/memdisk/memdisk.h +++ b/memdisk/memdisk.h @@ -47,6 +47,23 @@ memcpy_endptr(void *__d, const void *__s, unsigned int __n) return (void *)((char *)__d + __n); } +/* memcmp() */ +static inline int +memcmp(const void *__a, const void *__b, unsigned int __n) +{ + const unsigned char *__aa = __a; + const unsigned char *__bb = __b; + int __d; + + while ( __n ) { + __d = *__bb++ - *__aa++; + if ( __d ) + return __d; + } + + return 0; +} + /* Decompression */ extern int check_zip(void *indata, uint32_t size, uint32_t *zbytes_p, uint32_t *dbytes_p, uint32_t *orig_crc, diff --git a/memdisk/setup.c b/memdisk/setup.c index 0832a266..f8de652a 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -408,8 +408,7 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size) /* Do we have a DOSEMU header? */ memcpy(&dosemu, (char *)where+hd_geometry.offset, sizeof dosemu); - if ( ((unsigned long *)dosemu.magic)[0] == FOUR('D','O','S','E') && - (((unsigned long *)dosemu.magic)[1] & 0xffffff) == FOUR('M','U',0,0) ) { + if ( !memcmp("DOSEMU", dosemu.magic, 7) ) { /* Always a hard disk unless overruled by command-line options */ hd_geometry.driveno = 0x80; hd_geometry.type = 0; |