Mail Archives: djgpp-workers/1998/10/04/07:47:11
Did you notice that `getmntent' on plain DOS returns a bogus filesystem
name for floppies that were written with LFN support? Well, the
following patch should correct that:
*** src/libc/compat/mntent/mntent.c~1 Fri Oct 2 11:33:12 1998
--- src/libc/compat/mntent/mntent.c Fri Oct 2 19:50:48 1998
*************** getmntent(FILE *filep)
*** 750,760 ****
{
/* Look for the volume label. */
int e = errno;
strcat(drive_string, "*.*");
errno = 0;
! if (!findfirst(drive_string, &mnt_ff, FA_LABEL))
{
errno = e;
--- 750,773 ----
{
/* Look for the volume label. */
int e = errno;
+ int volume_found = 0;
strcat(drive_string, "*.*");
errno = 0;
+ volume_found = findfirst(drive_string, &mnt_ff, FA_LABEL) == 0;
+ /* Floppies and other disks written by Windows 9X include
+ entries that have volume label bit set, but they are
+ actually parts of some LFN entry. We only accept volume
+ labels which have all their RHS bits reset; otherwise
+ we pretend we never saw that label. */
+ if (volume_found &&
+ (mnt_ff.ff_attrib & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM)) != 0)
+ {
+ volume_found = 0;
+ errno = ENMFILE;
+ }
! if (volume_found)
{
errno = e;
*** src/docs/kb/wc202.t~2 Fri Oct 2 12:59:26 1998
--- src/docs/kb/wc202.txi Fri Oct 2 19:53:42 1998
***************
*** 292,298 ****
@code{getmntent} better supports Windows NT and doesn't cause DOS to
return stale data when the disk is changed. Removable media such as JAZ
! drives are no longer reported when the drive is empty.
@findex getmntent
File names which begin with @file{/dev/} or @file{x:/dev/} (where
--- 292,300 ----
@code{getmntent} better supports Windows NT and doesn't cause DOS to
return stale data when the disk is changed. Removable media such as JAZ
! drives are no longer reported when the drive is empty. Disks written by
! Windows 9X are no longer reported with bogus names taken from LFN
! directory entries (which have their volume label attribute bit set).
@findex getmntent
File names which begin with @file{/dev/} or @file{x:/dev/} (where
- Raw text -