Date: Wed, 11 Sep 1996 07:18:50 +0200 (IST) From: Eli Zaretskii To: Robert Hoehne Cc: DJ Delorie , djgpp-workers AT delorie DOT com Subject: Re: V2 alpha 980908 -- stat.c In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII > I have tested it in several cases and include here the resulting outputs: > In my opinion the bug has something to do with no correct identifying > a drive, which is created with subst and also some wrong things, when > I start the program 'stat.exe' with or without redir. The case of SUBST was broken. Patches below. Anybody who works seriously with SUBSTed drives should patch libc.a and rebuild every tool in use, because *nothing* will work on a SUBSTed drive without this patch (`stat' is used too heavily). Sorry about the mess. Other than the case of SUBST, I found nothing wrong with the last snapshot of `stat', but I don't have access to Windows 95, so if there are further problems, please tell me about them. *** stat.c~0 Sun Sep 1 01:09:32 1996 --- stat.c Tue Sep 10 22:25:10 1996 *************** stat_assist(const char *path, struct sta *** 552,561 **** original drive letter; other redirectors will probably do their weird things. This could totally confuse FindFirst. DOS_PATH takes the pathname from CANON_PATH, but replaces the UNC prefix with a ! drive letter. */ ! if (path_offset >= 0) strcpy (dos_path + 3, canon_path + path_offset); if (!__findfirst(dos_path, &ff_blk, ALL_FILES)) { --- 552,565 ---- original drive letter; other redirectors will probably do their weird things. This could totally confuse FindFirst. DOS_PATH takes the pathname from CANON_PATH, but replaces the UNC prefix with a ! drive letter. (However, if CANON_PATH comes with a drive different ! from what we got from PATH, we will just use PATH in FindFirst, ! because the *real* drive might be illegal, as in JOIN.) */ ! if (path_offset >= 0 && drv_no == dos_path[0]) strcpy (dos_path + 3, canon_path + path_offset); + else + strcpy (dos_path, path); if (!__findfirst(dos_path, &ff_blk, ALL_FILES)) { *************** main(int argc, char *argv[]) *** 900,907 **** exit(0); } ! stat(*argv, &stat_buf); ! fprintf(stderr, "DOS %d.%d (%s)\n", _osmajor, _osminor, _os_flavor); argc--; argv++; _djstat_flags = (unsigned short)strtoul(*argv, &endp, 0); --- 904,913 ---- exit(0); } ! if (stat(*argv, &stat_buf) != 0) ! perror ("stat failed on argv[0]"); ! else ! fprintf(stderr, "DOS %d.%d (%s)\n", _osmajor, _osminor, _os_flavor); argc--; argv++; _djstat_flags = (unsigned short)strtoul(*argv, &endp, 0);