#594448 mtools: mpartition -B mbr.bin fails with silly error message.

Package:
mtools
Source:
mtools
Description:
Tools for manipulating MSDOS files
Submitter:
Peter Chubb
Date:
2010-08-26 04:45:04 UTC
Severity:
normal
#594448#5
Date:
2010-08-26 03:59:56 UTC
From:
To:
I do:
  dd if=/dev/zero of=diskimage count=`expr 255*63*1000` bs=512
  echo 'drive c file=diskimage partition=1 blocksize=512 cylinders=1000 heads=63 sectors=255' > mtoolsrc
  export MTOOLSRC=`pwd`/mtoolsrc
  mpartition -I -B /usr/lib/syslinux/mbr.bin c:

and get:
read MBR: Inappropriate ioctl for device


Looking at the source, this comes from line 532 of mpartition.c
which says:
			if(read(fd, (char *) buf, 512) < 512) {
				perror("read MBR");
				exit(1);
			}

fd here points at /usr/lib/syslinux/mbr.bin which is 440 bytes long.
I suspect that the inequality should be <0 not <512.
Changing it that way makes mpartition work.