bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: readdir on Windows, again


From: Eli Zaretskii
Subject: Re: readdir on Windows, again
Date: Tue, 12 Dec 2023 05:31:58 +0200

> From: arnold@skeeve.com
> Date: Mon, 11 Dec 2023 13:31:57 -0700
> 
> Can you explain the change in pc/gawkmisc.pc:optimal_bufsize? Why are
> you checking the contents of the stat buffer before calling fstat?
> The calling code expects optimal_bufsize() to call fstat for it.

optimal_bufsize is called with a "fake" file descriptor that readdir.c
extension invents for directories.  Calling fstat on that produces a
fatal error.  So we must check for a directory before we call fstat.

The stat buffer passed to optimal_bufsize already includes data from a
previous call to stat, done by the caller.

I'm okay with any other fix in that part, e.g. if you prefer not to
call optimal_bufsize at all in this case, and instead have some simple
MinGW-only fix in iop_finish which calls optimal_bufsize.  Solving
this in Windows-only code seemed a bit cleaner to me, so I did it that
way.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]