emacs-devel
[Top][All Lists]
Advanced

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

Re: patch about moving file (or directory) to the Recycle Bin on Windows


From: Eli Zaretskii
Subject: Re: patch about moving file (or directory) to the Recycle Bin on Windows NT series
Date: Wed, 23 Apr 2008 07:55:02 +0300

> From: Stefan Monnier <address@hidden>
> Cc: Toru TSUNEYOSHI <address@hidden>,  address@hidden
> Date: Tue, 22 Apr 2008 21:14:30 -0400
> 
> >> +      /* On Unix, unlink works without write permission. */
> >> +      _chmod (path, 0666);
> 
> > Can this somehow leave the file writable without deleting it, if the
> > code is interrupted before it gets to undo this _chmod call?  If so,
> > we need to guard against that somehow.
> 
> Also that makes the file temporarily readable/writable by everybody.
> It's probably better to set it to 0600.  Of course, maybe this is
> irrelevant because of the way w32 interprets those
> Unix-style permissions.

Yes, 0600 and 0666 are the same on Windows.  When using the Posix
emulation functions, such as _chmod, there's only 1 bit that describes
whether the file is writable or not.

If we really care about this, we need to use the security API, where a
full-blown ACL functionality is available.

Alternatively, we could simply let the call fail for files not
writable by the user: after all, this is what the Windows Explorer
will do when you delete files through it.




reply via email to

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