void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}
int dup (fhandler_base *child);
int ioctl (unsigned int cmd, void *);
- void fixup_after_fork (HANDLE);
+ virtual void fixup_after_fork (HANDLE);
void fixup_after_exec ();
bool hit_eof ();
void set_eof () {broken_pipe = true;}
class fhandler_fifo: public fhandler_pipe
{
HANDLE output_handle;
- HANDLE owner; // You can't have too many mutexes, now, can you?
long read_use;
long write_use;
virtual HANDLE& get_io_handle () { return io_handle ?: output_handle; }
if (get_io_handle ())
{
- if (nohandle ())
+ if (nohandle () || is_fs_special ())
return fstat_by_name (buf);
else
return fstat_by_handle (buf);
buf->st_blocks = (nAllocSize + S_BLKSIZE - 1) / S_BLKSIZE;
else if (pc.has_attribute (FILE_ATTRIBUTE_COMPRESSED
| FILE_ATTRIBUTE_SPARSE_FILE)
- && get_io_handle ()
+ && get_io_handle () && !is_fs_special ()
&& !NtQueryInformationFile (get_io_handle (), &st, (PVOID) &fci,
sizeof fci, FileCompressionInformation))
/* Otherwise we request the actual amount of bytes allocated for
else if (pc.issocket ())
buf->st_mode = S_IFSOCK;
- if (!get_file_attribute (pc.has_acls (), get_io_handle (), get_win32_name (),
- &buf->st_mode, &buf->st_uid, &buf->st_gid))
+ if (!get_file_attribute (pc.has_acls (), is_fs_special () ? NULL: get_io_handle (),
+ get_win32_name (), &buf->st_mode, &buf->st_uid, &buf->st_gid))
{
/* If read-only attribute is set, modify ntsec return value */
if (pc.has_attribute (FILE_ATTRIBUTE_READONLY) && !pc.issymlink ())
{
buf->st_mode |= STD_RBITS;
- if (!pc.has_attribute (FILE_ATTRIBUTE_READONLY))
+ if (!pc.has_attribute (FILE_ATTRIBUTE_READONLY) && !pc.issymlink ())
buf->st_mode |= STD_WBITS;
/* | S_IWGRP | S_IWOTH; we don't give write to group etc */
__seterrno ();
goto out;
}
- if (!DuplicateHandle (hMainProc, fh->get_handle (), hMainProc,
+ if (!DuplicateHandle (hMainProc, fh->get_output_handle (), hMainProc,
&r.handles[1], 0, false, DUPLICATE_SAME_ACCESS))
{
CloseHandle (r.handles[0]);
goto out;
fhandler_pipe *fhs[2];
- if (create (fhs, 0, flags, true))
+ if (create (fhs, 1, flags, true))
{
__seterrno ();
res = 0;
}
else
{
- set_flags (fhs[0]->get_flags ());
+ set_flags (flags);
set_io_handle (fhs[0]->get_handle ());
set_output_handle (fhs[1]->get_handle ());
guard = fhs[0]->guard;
it[0] = it[1] = NULL; /* FIXME: possibly left a handle open in child? */
break;
}
+ debug_printf ("fifo found %p, %p", it[0], it[1]);
}
CloseHandle (hp);