msdosfs bug?

Andrey Sverdlichenko blaze at infosec.ru
Wed Jul 2 05:22:43 PDT 2003


Hello.

After running this program with msdosfs mounted in /mnt, I got a 
file with some garbage in skipped space. Is it a bug in my local
installation/hardware or real kernel bug?

FreeBSD xen.infosec.ru 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Thu Apr 17
16:53:27 MSD 2003     root at xen.infosec.ru:/usr/src/sys/compile/XEN  i386

#include <fcntl.h>
#include <unistd.h>

int
main(void) {
	char buf[100] = "placeholder";
	off_t pos;
	int handle = open("/mnt/foo", O_RDWR | O_CREAT | O_TRUNC, 0664);

	if (handle == -1)
		return 1;

	pos = lseek(handle, 1024 * 16 - 100, SEEK_SET);
	if (pos != 1024 * 16 - 100)
		return 1;

	if (write(handle, buf, 100) != 100)
		return 1;

	if (close(handle))
		return 1;

	return 0;
}



More information about the freebsd-stable mailing list