Mail Archives: djgpp-workers/2012/03/10/12:37:19
Am Dienstag, 28. Februar 2012 schrieb Juan Manuel Guerrero:
> There is a bug in _get_cached_blksize(). The drive number passed to
> _is_remote_drive() is incremented in the argument. In _is_remote_drive itself
> that drive number is incremented a second time making become the block size
> wrong under certain circumstances. I noticed this while I was trying to port
> gdbm 1.9.1. The testsuite failed depending if the test data base file was
> locate on a drive before or after a CDROM drive. gdbm uses the st_blksize
> value to create an initial hash table directory. If this value does not match
> other drive and file specific values the data base file is assumed to be
> corrupt and gdbm stops working.
[snip]
OFYI, to solve the issue I have commited the following patch.
Regards,
Juan M. Guerrero
Index: djgpp/src/libc/dos/dos/remotdrv.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/dos/remotdrv.c,v
retrieving revision 1.1
diff -U 5 -r1.1 remotdrv.c
--- djgpp/src/libc/dos/dos/remotdrv.c 21 May 1995 06:32:50 -0000 1.1
+++ djgpp/src/libc/dos/dos/remotdrv.c 10 Mar 2012 17:32:59 -0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2012 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
/*
* This is file REMOTDRV.C
*
* Copyright (c) 1994, 1995 Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
@@ -16,11 +17,12 @@
int _is_remote_drive(int);
/* Return 1 if the named DRIVE is remote (i.e., networked) drive,
0 if not. Return -1 if the call failed.
- Call with drive NUMBER, not letter, i.e. 1 = 'A', 2 = 'B', etc. */
+ Call with drive NUMBER, not letter, i.e. 0 = 'A', 1 = 'B', etc.
+ The drive number passed as argument to the function must be zero based !! */
int
_is_remote_drive(int drv_no)
{
__dpmi_regs regs;
@@ -55,6 +57,5 @@
}
if (regs.x.dx & 0x1000)
return 1;
return 0;
}
-
Index: djgpp/src/libc/posix/sys/stat/xstat.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/xstat.c,v
retrieving revision 1.4
diff -U 5 -r1.4 xstat.c
--- djgpp/src/libc/posix/sys/stat/xstat.c 1 Dec 2001 20:22:37 -0000 1.4
+++ djgpp/src/libc/posix/sys/stat/xstat.c 10 Mar 2012 17:32:59 -0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2012 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
/*
* This is file XSTAT.C
*
@@ -162,11 +163,11 @@
return -1;
}
if (!cache_blksize[d])
{
- if (_is_remote_drive(d + 1))
+ if (_is_remote_drive(d)) /* A = 0, B = 1, C = 2, etc. */
{
/* Default remote drives to 4K block size, to improve performance.
*
* Also the size returned by statfs() may not be correct. Testing
* against files shared by Samba 2.0.10 on Linux kernel 2.2.19
- Raw text -