delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/02/22/15:06:59

Date: Sat, 22 Feb 2003 22:03:05 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: rich AT phekda DOT freeserve DOT co DOT uk
Message-Id: <2427-Sat22Feb2003220304+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp-workers AT delorie DOT com
In-reply-to: <3E54E663.5F32DFF7@phekda.freeserve.co.uk> (message from Richard
Dawe on Thu, 20 Feb 2003 14:29:55 +0000)
Subject: Re: Implementation of fchmod [PATCH]
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1030206081714 DOT 6656L-100000 AT is> <3E54E663 DOT 5F32DFF7 AT phekda DOT freeserve DOT co DOT uk>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019