This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: 1.7.5: Occasional failure of CreatePipe or signal handing due to thread-unsafe code in cwdstuff::set
On Thu, Aug 12, 2010 at 04:48:48PM +0200, Corinna Vinschen wrote:
>On Aug 12 16:38, Corinna Vinschen wrote:
>> On Aug 12 10:12, Christopher Faylor wrote:
>> > I've done some googling but I can't find an answer to this: Is it
>> > possible to create a directory which can't be written to - even by a
>> > privileged user?
>>
>> No. I never came across a directory which is not writable under
>> SE_BACKUP_NAME conditions.
>
>What if we create a subdirectory like C:/cygwin/.for_win32_only
>for exactly this one single purpose, to redirect any relative
>Win32 calls there?
I guess that would be an acceptable compromise if the below doesn't past
muster:
On XP, at least, we could set the current directory to '//?/PIPE'.
That causes CreateFile to fail. I used the program below to test
that.
sh-3.2$ ./setdir '//?/PIPE'
SetCurrentDirectory succeeded
CreateFile failed, 123
I'll try that on other systems to see if it still behaves predictably.
cgf
#include <windows.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
if (!SetCurrentDirectory (argv[1]))
printf ("SetCurrentDIrectory failed, %d\n", GetLastError ());
else
{
puts ("SetCurrentDirectory succeeded");
HANDLE h = CreateFile ("foo", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (h != INVALID_HANDLE_VALUE)
puts ("CreateFile succeeded");
else
printf ("CreateFile failed, %d\n", GetLastError ());
}
}