[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]
[MD:1764] Bug fix of file-readable-p
- X-ml-count: 1764
- Subject: [MD:1764] Bug fix of file-readable-p
- From: Miyashita Hisashi(宮下 尚:HIMI) <himi@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: 17 Apr 2000 20:31:03 +0900
- User-agent: T-gnus/6.14.1 (based on Gnus v5.8.3) SEMI/1.13.5 (Meihō) FLIM/1.13.2 (Kasanui) Emacs/20.6 (i386-*-nt5.0.2195) MULE/4.1 (AOI) Meadow/1.13 Beta1 (TANAHASHI:61)
Eli Zaretskii <eliz@xxxxxxxxxxxxx> writes:
> + #ifdef WINDOWSNT
> + /* The read-only attribute of the parent directory doesn't affect
> + whether a file or directory can be created within it. Some day we
> + should check ACLs though, which do affect this. */
> + if (stat (XSTRING (dir)->data, &statbuf) < 0)
> + return Qnil;
> + return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil;
>
> IIRC, `stat' fails (returns -1) on Windows for root directories. If I'm
> right, this means that file-writable-p, as you suggest to patch it, will
> return nil for any file in the root directory of any drive.
Because NTEmacs implements stat() by itself,
your surmise does not hold.
The following tests follow it.
(file-writable-p "c:/")
-->t
(file-writable-p "c:/AUTOEXEC.BAT")
-->t
NTEmacs frequently uses stat() in many functions.
So if it fails, we would meet many troubles on file I/O.
from himi