This patch is due to Eli. It will reside on my patch site shortly.
*** src/libc/posix/sys/stat/stat.c~4 Wed May 28 08:49:56 1997
--- src/libc/posix/sys/stat/stat.c Tue Jan 6 21:44:04 1998
*************** stat_assist(const char *path, struct sta
*** 472,477 ****
--- 472,478 ----
invented inode and one which belongs to a real file. This is
also compatible with what our fstat() does.
*/
+ char_dev:
if (canon_path[2] == '/')
{
char dev_name[9]; /* devices are at most 8 characters long */
*************** stat_assist(const char *path, struct sta
*** 594,599 ****
--- 595,621 ----
statbuf->st_mode |= READ_ACCESS;
if ( !(ff_blk.ff_attrib & 0x07) ) /* no R, H or S bits set */
statbuf->st_mode |= WRITE_ACCESS;
+
+ /* Sometimes `_truename' doesn't return X:/FOO for character
+ devices. However, FindFirst returns attribute 40h for them. */
+ if (ff_blk.ff_attrib == 0x40)
+ {
+ size_t cplen = strlen (canon_path);
+ char *pslash = canon_path + cplen - 1;
+
+ while (pslash > canon_path + 2 && *pslash != '\')
+ pslash--;
+
+ /* Force it into X:/FOO form. */
+ if (canon_path[1] == ':')
+ {
+ if (pslash > canon_path + 2)
+ memmove (canon_path + 2, pslash,
+ cplen - (pslash - canon_path) + 1);
+ canon_path[2] = '/';
+ goto char_dev;
+ }
+ }
/* Directories should have Execute bits set. */
if (ff_blk.ff_attrib & 0x10)