Mail Archives: djgpp-workers/2003/02/22/15:06:59
> Date: Thu, 20 Feb 2003 14:29:55 +0000
> From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
> 
> > I presume that you've actually run the test program, but I still wonder:
> > does it work on DOS and Windows (including on the NT family) to change
> > the file's read/write permissions while it is open?  What happens if I
> > open a file, write something to it, then change its mode to be read-only,
> > and then try to write some more?
> 
> It seems like DOS boxes under Windows (the LFN API, at least) have a separate
> concept of open mode and attributes. So you can create a file that is
> read-only, but open it in read-write mode at creation time. See the recent
> discussion about _creatnew. The attributes seem to apply to opens after that
> point.
> It seems like you can change the file attributes from, say, read-write to
> read-only on a file that was opened for read-write and still write to it:
> 
>     open for read-write
>     write to file
>     change attributes to read-only
>     write to file
>     close file
> 
> None of this fails on Windows '98 SE.
This should be documented, I think, since Posix systems behave
differently.
> I suspect it will fail under DOS, where the LFN API is not present and there
> is no extended create call. I have not done any testing yet.
Could someone please see what does DOS do with that?  W2K/XP might
also behave differently.
> Here's what I've implemented so far:
> 
>     let fsext handle it, if it wants
> 
>     if it's a character device, ignore the request and return success
> 
>     try to find out current permissions - if they match the requested ones,
> just return
> 
>     if no filename is known from fd_props, fail with errno == ENOENT
> 
>     otherwise do a chmod on the filename
This sounds okay.
- Raw text -