* cygheap.cc (creturn): Reorganize to avoid a new compiler warning/error.
* dtable.cc (handle_to_fn): Ditto. * fhandler_console.cc (fhandler_console::read): Ditto. (fhandler_console::scroll_screen): Ditto. (dev_console::set_color): Ditto. * fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto. (fhandler_dev_dsp::read): Ditto. * fhandler_tape.cc (mtinfo_drive::get_status): Ditto. * hookapi.cc (find_first_notloaded_dll): Ditto. * mmap.cc (msync): Ditto. * pipe.cc (pipesync::pipesync): Ditto. * sec_acl.cc (getace): Ditto. * sec_auth.cc (create_token): Ditto. (lsaauth): Ditto. * select.cc (peek_pipe): Ditto. * spawn.cc (av::fixup): Ditto. * syscalls.cc (popen): Ditto. * tty.cc (tty::init_session): Ditto. * uinfo.cc (pwdgrp::load): Ditto. * fhandler.cc (fhandler_base::setup_overlapped): Ditto. (fhandler_base::wait_overlapped): Rename second use of res variable to wres or errors are not returned correctly. * dcrt0.cc: Remove obsolete variable. * dll_init.cc (release_upto): Fix typo involving incorrect use of '|'. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a compiler warning regarding coercing type-punned variables. (fhandler_base::fstat_by_name): Ditto. fhandler_fifo.cc (fhandler_fifo::open_nonserver): Fix = vs. == typo. (fhandler_fifo::wait): Add all conditions to switch statement to avoid a compiler warning. * fhandler_process.cc: Avoid unneeded initialization of variables to zero. (fhandler_socket::listen): Add braces around initializer. * flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a compiler warning. Fix problem with EWOULDBLOCK error return. * path.cc (GUID_shortcut): Use braces around struct initializer. (cygwin_conv_path): Reorganize to avoid a compiler warning. * random.cc (dummy): Mark variable as volatile to avoid a "used uninitialized" warning. * libc/getopt.c: Mark some variables as dllexport although gcc doesn't seem to do the right thing with them. * libc/minires-os-if.c (get_registry_dns_items): Coerce some function arguments to avoid a compiler warning.
This commit is contained in:
parent
0b840b0009
commit
7b9e380f03
@ -1,3 +1,50 @@
|
||||
2008-09-11 Christopher Faylor <me+cygwin@cgf.cx>
|
||||
|
||||
* cygheap.cc (creturn): Reorganize to avoid a new compiler
|
||||
warning/error.
|
||||
* dtable.cc (handle_to_fn): Ditto.
|
||||
* fhandler_console.cc (fhandler_console::read): Ditto.
|
||||
(fhandler_console::scroll_screen): Ditto.
|
||||
(dev_console::set_color): Ditto.
|
||||
* fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto.
|
||||
(fhandler_dev_dsp::read): Ditto.
|
||||
* fhandler_tape.cc (mtinfo_drive::get_status): Ditto.
|
||||
* hookapi.cc (find_first_notloaded_dll): Ditto.
|
||||
* mmap.cc (msync): Ditto.
|
||||
* pipe.cc (pipesync::pipesync): Ditto.
|
||||
* sec_acl.cc (getace): Ditto.
|
||||
* sec_auth.cc (create_token): Ditto.
|
||||
(lsaauth): Ditto.
|
||||
* select.cc (peek_pipe): Ditto.
|
||||
* spawn.cc (av::fixup): Ditto.
|
||||
* syscalls.cc (popen): Ditto.
|
||||
* tty.cc (tty::init_session): Ditto.
|
||||
* uinfo.cc (pwdgrp::load): Ditto.
|
||||
* fhandler.cc (fhandler_base::setup_overlapped): Ditto.
|
||||
(fhandler_base::wait_overlapped): Rename second use of res variable to
|
||||
wres or errors are not returned correctly.
|
||||
* dcrt0.cc: Remove obsolete variable.
|
||||
* dll_init.cc (release_upto): Fix typo involving incorrect use of '|'.
|
||||
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a
|
||||
compiler warning regarding coercing type-punned variables.
|
||||
(fhandler_base::fstat_by_name): Ditto. fhandler_fifo.cc
|
||||
(fhandler_fifo::open_nonserver): Fix = vs. == typo.
|
||||
(fhandler_fifo::wait): Add all conditions to switch statement to avoid
|
||||
a compiler warning.
|
||||
* fhandler_process.cc: Avoid unneeded initialization of variables to
|
||||
zero.
|
||||
(fhandler_socket::listen): Add braces around initializer.
|
||||
* flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a
|
||||
compiler warning. Fix problem with EWOULDBLOCK error return.
|
||||
* path.cc (GUID_shortcut): Use braces around struct initializer.
|
||||
(cygwin_conv_path): Reorganize to avoid a compiler warning.
|
||||
* random.cc (dummy): Mark variable as volatile to avoid a "used
|
||||
uninitialized" warning.
|
||||
* libc/getopt.c: Mark some variables as dllexport although gcc doesn't
|
||||
seem to do the right thing with them.
|
||||
* libc/minires-os-if.c (get_registry_dns_items): Coerce some function
|
||||
arguments to avoid a compiler warning.
|
||||
|
||||
2008-08-27 Christopher Faylor <me+cygwin@cgf.cx>
|
||||
|
||||
* fhandler_tty.cc (close_maybe): Check for both types of invalid handle
|
||||
|
@ -244,14 +244,15 @@ _crealloc (void *ptr, unsigned size)
|
||||
inline static void *
|
||||
creturn (cygheap_types x, cygheap_entry * c, unsigned len, const char *fn = NULL)
|
||||
{
|
||||
if (!c)
|
||||
if (fn)
|
||||
api_fatal ("%s would have returned NULL", fn);
|
||||
else
|
||||
{
|
||||
set_errno (ENOMEM);
|
||||
return NULL;
|
||||
}
|
||||
if (c)
|
||||
/* nothing to do */;
|
||||
else if (fn)
|
||||
api_fatal ("%s would have returned NULL", fn);
|
||||
else
|
||||
{
|
||||
set_errno (ENOMEM);
|
||||
return NULL;
|
||||
}
|
||||
c->type = x;
|
||||
char *cend = ((char *) c + sizeof (*c) + len);
|
||||
if (cygheap_max < cend)
|
||||
|
@ -104,9 +104,6 @@ extern "C"
|
||||
};
|
||||
bool ignore_case_with_glob;
|
||||
int __declspec (dllexport) _check_for_executable = true;
|
||||
#ifdef DEBUGGING
|
||||
int pinger;
|
||||
#endif
|
||||
};
|
||||
|
||||
int NO_COPY __api_fatal_exit_val = 1;
|
||||
|
@ -79,7 +79,6 @@ void __stdcall modify_handle (const char *, int, HANDLE, const char *, bool)
|
||||
__attribute__ ((regparm (3)));
|
||||
void setclexec (HANDLE, HANDLE, bool);
|
||||
void debug_fixup_after_fork_exec ();
|
||||
extern int pinger;
|
||||
|
||||
struct handle_list
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ release_upto (const PWCHAR name, DWORD here)
|
||||
(((void *) start < cygheap->user_heap.base
|
||||
|| (void *) start > cygheap->user_heap.top) &&
|
||||
((void *) start < (void *) cygheap
|
||||
| (void *) start > (void *) ((char *) cygheap + CYGHEAPSIZE)))))
|
||||
|| (void *) start > (void *) ((char *) cygheap + CYGHEAPSIZE)))))
|
||||
continue;
|
||||
if (!VirtualFree ((void *) start, 0, MEM_RELEASE))
|
||||
api_fatal ("couldn't release memory %p(%d) for '%W' alignment, %E\n",
|
||||
|
@ -853,124 +853,117 @@ handle_to_fn (HANDLE h, char *posix_fn)
|
||||
|
||||
NtQueryObject (h, ObjectNameInformation, &dummy_oni, sizeof (dummy_oni), &len);
|
||||
if (!len)
|
||||
debug_printf ("NtQueryObject failed 1");
|
||||
else
|
||||
{
|
||||
debug_printf ("NtQueryObject failed 1");
|
||||
goto unknown;
|
||||
}
|
||||
OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) alloca (len + sizeof (WCHAR));
|
||||
NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, len, NULL);
|
||||
|
||||
OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) alloca (len + sizeof (WCHAR));
|
||||
NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, len, NULL);
|
||||
|
||||
if (!NT_SUCCESS (res))
|
||||
{
|
||||
debug_printf ("NtQueryObject failed 2");
|
||||
goto unknown;
|
||||
}
|
||||
|
||||
// NT seems to do this on an unopened file
|
||||
if (!ntfn->Name.Buffer)
|
||||
{
|
||||
debug_printf ("nt->Name.Buffer == NULL");
|
||||
goto unknown;
|
||||
}
|
||||
|
||||
WCHAR *w32 = ntfn->Name.Buffer;
|
||||
size_t w32len = ntfn->Name.Length / sizeof (WCHAR);
|
||||
w32[w32len] = L'\0';
|
||||
|
||||
if (wcscasecmp (w32, DEV_NULL) == 0)
|
||||
{
|
||||
strcpy (posix_fn, "/dev/null");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wcsncasecmp (w32, DEV_NAMED_PIPE, DEV_NAMED_PIPE_LEN) == 0)
|
||||
{
|
||||
w32 += DEV_NAMED_PIPE_LEN;
|
||||
if (wcsncmp (w32, L"cygwin-", WCLEN (L"cygwin-")) != 0)
|
||||
return false;
|
||||
w32 += WCLEN (L"cygwin-");
|
||||
bool istty = wcsncmp (w32, L"tty", WCLEN (L"tty")) == 0;
|
||||
if (istty)
|
||||
decode_tty (posix_fn, w32 + WCLEN (L"tty"));
|
||||
else if (wcsncmp (w32, L"pipe", WCLEN (L"pipe")) == 0)
|
||||
strcpy (posix_fn, "/dev/pipe");
|
||||
return istty;
|
||||
}
|
||||
|
||||
|
||||
WCHAR fnbuf[64 * 1024];
|
||||
if (wcsncasecmp (w32, DEVICE_PREFIX, DEVICE_PREFIX_LEN) != 0
|
||||
|| !QueryDosDeviceW (NULL, fnbuf, sizeof (fnbuf)))
|
||||
{
|
||||
sys_wcstombs (posix_fn, NT_MAX_PATH, w32, w32len);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (WCHAR *s = fnbuf; *s; s = wcschr (s, '\0') + 1)
|
||||
{
|
||||
WCHAR device[NT_MAX_PATH];
|
||||
if (!QueryDosDeviceW (s, device, sizeof (device)))
|
||||
continue;
|
||||
if (wcschr (s, ':') == NULL)
|
||||
continue;
|
||||
WCHAR *q = wcsrchr (device, ';');
|
||||
if (q)
|
||||
{
|
||||
WCHAR *r = wcschr (q, '\\');
|
||||
if (r)
|
||||
wcscpy (q, r + 1);
|
||||
}
|
||||
int devlen = wcslen (device);
|
||||
if (device[devlen - 1] == L'\\')
|
||||
device[--devlen] = L'\0';
|
||||
if (devlen < maxmatchlen)
|
||||
continue;
|
||||
if (wcsncmp (device, w32, devlen) != 0||
|
||||
(w32[devlen] != L'\0' && w32[devlen] != L'\\'))
|
||||
continue;
|
||||
maxmatchlen = devlen;
|
||||
maxmatchdos = s;
|
||||
debug_printf ("current match '%W' = '%W'\n", s, device);
|
||||
}
|
||||
|
||||
if (maxmatchlen)
|
||||
{
|
||||
WCHAR *p = wcschr (w32 + DEVICE_PREFIX_LEN, L'\\');
|
||||
size_t n = wcslen (maxmatchdos);
|
||||
WCHAR ch;
|
||||
if (!p)
|
||||
ch = L'\0';
|
||||
if (!NT_SUCCESS (res))
|
||||
debug_printf ("NtQueryObject failed 2");
|
||||
// NT seems to do this on an unopened file
|
||||
else if (!ntfn->Name.Buffer)
|
||||
debug_printf ("nt->Name.Buffer == NULL");
|
||||
else
|
||||
{
|
||||
if (maxmatchdos[n - 1] == L'\\')
|
||||
n--;
|
||||
w32 += maxmatchlen - n;
|
||||
ch = L'\\';
|
||||
WCHAR *w32 = ntfn->Name.Buffer;
|
||||
size_t w32len = ntfn->Name.Length / sizeof (WCHAR);
|
||||
w32[w32len] = L'\0';
|
||||
|
||||
if (wcscasecmp (w32, DEV_NULL) == 0)
|
||||
{
|
||||
strcpy (posix_fn, "/dev/null");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wcsncasecmp (w32, DEV_NAMED_PIPE, DEV_NAMED_PIPE_LEN) == 0)
|
||||
{
|
||||
w32 += DEV_NAMED_PIPE_LEN;
|
||||
if (wcsncmp (w32, L"cygwin-", WCLEN (L"cygwin-")) != 0)
|
||||
return false;
|
||||
w32 += WCLEN (L"cygwin-");
|
||||
bool istty = wcsncmp (w32, L"tty", WCLEN (L"tty")) == 0;
|
||||
if (istty)
|
||||
decode_tty (posix_fn, w32 + WCLEN (L"tty"));
|
||||
else if (wcsncmp (w32, L"pipe", WCLEN (L"pipe")) == 0)
|
||||
strcpy (posix_fn, "/dev/pipe");
|
||||
return istty;
|
||||
}
|
||||
|
||||
|
||||
WCHAR fnbuf[64 * 1024];
|
||||
if (wcsncasecmp (w32, DEVICE_PREFIX, DEVICE_PREFIX_LEN) != 0
|
||||
|| !QueryDosDeviceW (NULL, fnbuf, sizeof (fnbuf)))
|
||||
{
|
||||
sys_wcstombs (posix_fn, NT_MAX_PATH, w32, w32len);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (WCHAR *s = fnbuf; *s; s = wcschr (s, '\0') + 1)
|
||||
{
|
||||
WCHAR device[NT_MAX_PATH];
|
||||
if (!QueryDosDeviceW (s, device, sizeof (device)))
|
||||
continue;
|
||||
if (wcschr (s, ':') == NULL)
|
||||
continue;
|
||||
WCHAR *q = wcsrchr (device, ';');
|
||||
if (q)
|
||||
{
|
||||
WCHAR *r = wcschr (q, '\\');
|
||||
if (r)
|
||||
wcscpy (q, r + 1);
|
||||
}
|
||||
int devlen = wcslen (device);
|
||||
if (device[devlen - 1] == L'\\')
|
||||
device[--devlen] = L'\0';
|
||||
if (devlen < maxmatchlen)
|
||||
continue;
|
||||
if (wcsncmp (device, w32, devlen) != 0||
|
||||
(w32[devlen] != L'\0' && w32[devlen] != L'\\'))
|
||||
continue;
|
||||
maxmatchlen = devlen;
|
||||
maxmatchdos = s;
|
||||
debug_printf ("current match '%W' = '%W'\n", s, device);
|
||||
}
|
||||
|
||||
if (maxmatchlen)
|
||||
{
|
||||
WCHAR *p = wcschr (w32 + DEVICE_PREFIX_LEN, L'\\');
|
||||
size_t n = wcslen (maxmatchdos);
|
||||
WCHAR ch;
|
||||
if (!p)
|
||||
ch = L'\0';
|
||||
else
|
||||
{
|
||||
if (maxmatchdos[n - 1] == L'\\')
|
||||
n--;
|
||||
w32 += maxmatchlen - n;
|
||||
ch = L'\\';
|
||||
}
|
||||
memcpy (w32, maxmatchdos, n * sizeof (WCHAR));
|
||||
w32[n] = ch;
|
||||
}
|
||||
else if (wcsncmp (w32, DEV_REMOTE, DEV_REMOTE_LEN) == 0)
|
||||
{
|
||||
w32 += DEV_REMOTE_LEN - 2;
|
||||
*w32 = L'\\';
|
||||
debug_printf ("remote drive");
|
||||
}
|
||||
else if (wcsncmp (w32, DEV_REMOTE1, DEV_REMOTE1_LEN) == 0)
|
||||
{
|
||||
w32 += DEV_REMOTE1_LEN - 2;
|
||||
*w32 = L'\\';
|
||||
debug_printf ("remote drive");
|
||||
}
|
||||
|
||||
cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, w32, posix_fn,
|
||||
NT_MAX_PATH);
|
||||
|
||||
debug_printf ("derived path '%W', posix '%s'", w32, posix_fn);
|
||||
return false;
|
||||
}
|
||||
memcpy (w32, maxmatchdos, n * sizeof (WCHAR));
|
||||
w32[n] = ch;
|
||||
}
|
||||
else if (wcsncmp (w32, DEV_REMOTE, DEV_REMOTE_LEN) == 0)
|
||||
{
|
||||
w32 += DEV_REMOTE_LEN - 2;
|
||||
*w32 = L'\\';
|
||||
debug_printf ("remote drive");
|
||||
}
|
||||
else if (wcsncmp (w32, DEV_REMOTE1, DEV_REMOTE1_LEN) == 0)
|
||||
{
|
||||
w32 += DEV_REMOTE1_LEN - 2;
|
||||
*w32 = L'\\';
|
||||
debug_printf ("remote drive");
|
||||
}
|
||||
|
||||
cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, w32, posix_fn,
|
||||
NT_MAX_PATH);
|
||||
|
||||
debug_printf ("derived path '%W', posix '%s'", w32, posix_fn);
|
||||
return false;
|
||||
|
||||
unknown:
|
||||
strcpy (posix_fn, unknown_file);
|
||||
return false;
|
||||
}
|
||||
|
@ -1665,7 +1665,7 @@ fhandler_base::setup_overlapped ()
|
||||
{
|
||||
OVERLAPPED *ov = get_overlapped ();
|
||||
memset (ov, 0, sizeof (*ov));
|
||||
return ov->hEvent = CreateEvent (&sec_none_nih, true, false, NULL);
|
||||
return (ov->hEvent = CreateEvent (&sec_none_nih, true, false, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1707,9 +1707,9 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
|
||||
if (&_my_tls == _main_tls)
|
||||
w4[n++] = signal_arrived;
|
||||
HANDLE h = writing ? get_output_handle () : get_handle ();
|
||||
DWORD res = WaitForMultipleObjects (n, w4, false, INFINITE);
|
||||
DWORD wres = WaitForMultipleObjects (n, w4, false, INFINITE);
|
||||
err = 0;
|
||||
switch (res)
|
||||
switch (wres)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
debug_printf ("normal read");
|
||||
|
@ -261,7 +261,7 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
|
||||
if (input_rec.Event.KeyEvent.bKeyDown &&
|
||||
virtual_key_code == VK_SCROLL &&
|
||||
control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED) == LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED
|
||||
((control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED)) == (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED))
|
||||
)
|
||||
{
|
||||
set_raw_win32_keyboard_mode (!dev_state->raw_win32_keyboard_mode);
|
||||
@ -568,11 +568,12 @@ fhandler_console::scroll_screen (int x1, int y1, int x2, int y2, int xn, int yn)
|
||||
/* ScrollConsoleScreenBuffer on Windows 95 is buggy - when scroll distance
|
||||
* is more than half of screen, filling doesn't work as expected */
|
||||
|
||||
if (sr1.Top != sr1.Bottom)
|
||||
if (dest.Y <= sr1.Top) /* forward scroll */
|
||||
clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom);
|
||||
else /* reverse scroll */
|
||||
clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1);
|
||||
if (sr1.Top == sr1.Bottom)
|
||||
/* nothing to do */;
|
||||
else if (dest.Y <= sr1.Top) /* forward scroll */
|
||||
clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom);
|
||||
else /* reverse scroll */
|
||||
clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -895,12 +896,13 @@ dev_console::set_color (HANDLE h)
|
||||
win_bg |= BACKGROUND_INTENSITY;
|
||||
if (intensity == INTENSITY_INVISIBLE)
|
||||
win_fg = win_bg;
|
||||
else if (intensity == INTENSITY_BOLD)
|
||||
else if (intensity != INTENSITY_BOLD)
|
||||
/* nothing to do */;
|
||||
/* apply foreground intensity only in non-reverse mode! */
|
||||
if (reverse)
|
||||
win_bg |= BACKGROUND_INTENSITY;
|
||||
else
|
||||
win_fg |= FOREGROUND_INTENSITY;
|
||||
else if (reverse)
|
||||
win_bg |= BACKGROUND_INTENSITY;
|
||||
else
|
||||
win_fg |= FOREGROUND_INTENSITY;
|
||||
|
||||
current_win32_attr = win_fg | win_bg;
|
||||
if (h)
|
||||
|
@ -350,11 +350,11 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
||||
pc.file_attributes (fai_buf.fai.BasicInformation.FileAttributes);
|
||||
return fstat_helper (buf,
|
||||
fai_buf.fai.BasicInformation.ChangeTime.QuadPart
|
||||
? *(FILETIME *) &fai_buf.fai.BasicInformation.ChangeTime
|
||||
: *(FILETIME *) &fai_buf.fai.BasicInformation.LastWriteTime,
|
||||
*(FILETIME *) &fai_buf.fai.BasicInformation.LastAccessTime,
|
||||
*(FILETIME *) &fai_buf.fai.BasicInformation.LastWriteTime,
|
||||
*(FILETIME *) &fai_buf.fai.BasicInformation.CreationTime,
|
||||
? *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.ChangeTime
|
||||
: *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
|
||||
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastAccessTime,
|
||||
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
|
||||
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.CreationTime,
|
||||
get_dev (),
|
||||
fai_buf.fai.StandardInformation.EndOfFile.QuadPart,
|
||||
fai_buf.fai.StandardInformation.AllocationSize.QuadPart,
|
||||
@ -417,11 +417,11 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
|
||||
pc.file_attributes (fdi_buf.fdi.FileAttributes);
|
||||
return fstat_helper (buf,
|
||||
fdi_buf.fdi.ChangeTime.QuadPart ?
|
||||
*(FILETIME *) &fdi_buf.fdi.ChangeTime :
|
||||
*(FILETIME *) &fdi_buf.fdi.LastWriteTime,
|
||||
*(FILETIME *) &fdi_buf.fdi.LastAccessTime,
|
||||
*(FILETIME *) &fdi_buf.fdi.LastWriteTime,
|
||||
*(FILETIME *) &fdi_buf.fdi.CreationTime,
|
||||
*(FILETIME *) (void *) &fdi_buf.fdi.ChangeTime :
|
||||
*(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime,
|
||||
*(FILETIME *) (void *) &fdi_buf.fdi.LastAccessTime,
|
||||
*(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime,
|
||||
*(FILETIME *) (void *) &fdi_buf.fdi.CreationTime,
|
||||
pc.fs_serial_number (),
|
||||
fdi_buf.fdi.EndOfFile.QuadPart,
|
||||
fdi_buf.fdi.AllocationSize.QuadPart,
|
||||
@ -434,10 +434,10 @@ too_bad:
|
||||
/* Arbitrary value: 2006-12-01 */
|
||||
RtlSecondsSince1970ToTime (1164931200L, &ft);
|
||||
return fstat_helper (buf,
|
||||
*(FILETIME *) &ft,
|
||||
*(FILETIME *) &ft,
|
||||
*(FILETIME *) &ft,
|
||||
*(FILETIME *) &ft,
|
||||
*(FILETIME *) (void *) &ft,
|
||||
*(FILETIME *) (void *) &ft,
|
||||
*(FILETIME *) (void *) &ft,
|
||||
*(FILETIME *) (void *) &ft,
|
||||
0,
|
||||
0ULL,
|
||||
-1LL,
|
||||
|
@ -1007,24 +1007,25 @@ fhandler_dev_dsp::write (const void *ptr, size_t len)
|
||||
int len_s = len;
|
||||
const char *ptr_s = static_cast <const char *> (ptr);
|
||||
|
||||
if (!audio_out_)
|
||||
if (IS_WRITE ())
|
||||
{
|
||||
debug_printf ("Allocating");
|
||||
if (!(audio_out_ = new Audio_out))
|
||||
return -1;
|
||||
|
||||
/* check for wave file & get parameters & skip header if possible. */
|
||||
|
||||
if (audio_out_->parsewav (ptr_s, len_s,
|
||||
audiofreq_, audiobits_, audiochannels_))
|
||||
debug_printf ("=> ptr_s=%08x len_s=%d", ptr_s, len_s);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_errno (EBADF); // device was opened for read?
|
||||
if (audio_out_)
|
||||
/* nothing to do */;
|
||||
else if (IS_WRITE ())
|
||||
{
|
||||
debug_printf ("Allocating");
|
||||
if (!(audio_out_ = new Audio_out))
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check for wave file & get parameters & skip header if possible. */
|
||||
|
||||
if (audio_out_->parsewav (ptr_s, len_s,
|
||||
audiofreq_, audiobits_, audiochannels_))
|
||||
debug_printf ("=> ptr_s=%08x len_s=%d", ptr_s, len_s);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_errno (EBADF); // device was opened for read?
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Open audio device properly with callbacks.
|
||||
Private parameters were set in call to parsewav.
|
||||
@ -1046,23 +1047,24 @@ fhandler_dev_dsp::read (void *ptr, size_t& len)
|
||||
if ((fhandler_dev_dsp *) archetype != this)
|
||||
return ((fhandler_dev_dsp *)archetype)->read(ptr, len);
|
||||
|
||||
if (!audio_in_)
|
||||
if (IS_READ ())
|
||||
{
|
||||
debug_printf ("Allocating");
|
||||
if (!(audio_in_ = new Audio_in))
|
||||
{
|
||||
len = (size_t)-1;
|
||||
return;
|
||||
}
|
||||
audio_in_->setconvert (audioformat_);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (size_t)-1;
|
||||
set_errno (EBADF); // device was opened for write?
|
||||
return;
|
||||
}
|
||||
if (audio_in_)
|
||||
/* nothing to do */;
|
||||
else if (IS_READ ())
|
||||
{
|
||||
debug_printf ("Allocating");
|
||||
if (!(audio_in_ = new Audio_in))
|
||||
{
|
||||
len = (size_t)-1;
|
||||
return;
|
||||
}
|
||||
audio_in_->setconvert (audioformat_);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (size_t)-1;
|
||||
set_errno (EBADF); // device was opened for write?
|
||||
return;
|
||||
}
|
||||
|
||||
/* Open audio device properly with callbacks.
|
||||
This is a noop when there are successive reads in the same process */
|
||||
|
@ -34,7 +34,7 @@ fhandler_fifo::open_nonserver (const char *npname, unsigned low_flags,
|
||||
DWORD mode = 0;
|
||||
if (low_flags == O_RDONLY)
|
||||
mode = GENERIC_READ;
|
||||
else if (low_flags = O_WRONLY)
|
||||
else if (low_flags == O_WRONLY)
|
||||
mode = GENERIC_WRITE;
|
||||
else
|
||||
mode = GENERIC_READ | GENERIC_WRITE;
|
||||
@ -131,11 +131,16 @@ fhandler_fifo::wait (bool iswrite)
|
||||
switch (wait_state)
|
||||
{
|
||||
case fifo_wait_for_client:
|
||||
bool res = ConnectNamedPipe (get_handle (), get_overlapped ());
|
||||
DWORD dummy_bytes;
|
||||
if (res || GetLastError () == ERROR_PIPE_CONNECTED)
|
||||
return true;
|
||||
return wait_overlapped (res, iswrite, &dummy_bytes);
|
||||
{
|
||||
bool res = ConnectNamedPipe (get_handle (), get_overlapped ());
|
||||
DWORD dummy_bytes;
|
||||
if (res || GetLastError () == ERROR_PIPE_CONNECTED)
|
||||
return true;
|
||||
return wait_overlapped (res, iswrite, &dummy_bytes);
|
||||
}
|
||||
case fifo_unknown:
|
||||
case fifo_wait_for_server:
|
||||
/* CGF FIXME SOON: test if these really need to be handled. */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
|
||||
{
|
||||
++*vmrss;
|
||||
unsigned flags = mwsl->WorkingSetList[i] & 0x0FFF;
|
||||
if (flags & (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE) == (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE))
|
||||
if ((flags & (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE)) == (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE))
|
||||
++*vmlib;
|
||||
else if (flags & WSLE_PAGE_SHAREABLE)
|
||||
++*vmshare;
|
||||
|
@ -408,9 +408,9 @@ fhandler_socket::af_local_set_secret (char *buf)
|
||||
#define LOCK_EVENTS WaitForSingleObject (wsock_mtx, INFINITE)
|
||||
#define UNLOCK_EVENTS ReleaseMutex (wsock_mtx)
|
||||
|
||||
static wsa_event wsa_events[NUM_SOCKS] __attribute__((section (".cygwin_dll_common"), shared)) = { 0 };
|
||||
static wsa_event wsa_events[NUM_SOCKS] __attribute__((section (".cygwin_dll_common"), shared));
|
||||
|
||||
static LONG socket_serial_number __attribute__((section (".cygwin_dll_common"), shared)) = 0;
|
||||
static LONG socket_serial_number __attribute__((section (".cygwin_dll_common"), shared));
|
||||
|
||||
static HANDLE wsa_slot_mtx;
|
||||
|
||||
@ -1091,7 +1091,7 @@ fhandler_socket::listen (int backlog)
|
||||
sin6_family: AF_INET6,
|
||||
sin6_port: 0,
|
||||
sin6_flowinfo: 0,
|
||||
sin6_addr: IN6ADDR_ANY_INIT,
|
||||
sin6_addr: {{IN6ADDR_ANY_INIT}},
|
||||
sin6_scope_id: 0
|
||||
};
|
||||
if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6))
|
||||
|
@ -801,11 +801,12 @@ mtinfo_drive::get_status (HANDLE mt, struct mtget *get)
|
||||
get->mt_fileno = part (partition)->file;
|
||||
get->mt_blkno = part (partition)->fblock;
|
||||
|
||||
if (get->mt_blkno == 0)
|
||||
if (get->mt_fileno == 0)
|
||||
get->mt_gstat |= GMT_BOT (-1);
|
||||
else
|
||||
get->mt_gstat |= GMT_EOF (-1);
|
||||
if (get->mt_blkno != 0)
|
||||
/* nothing to do */;
|
||||
else if (get->mt_fileno == 0)
|
||||
get->mt_gstat |= GMT_BOT (-1);
|
||||
else
|
||||
get->mt_gstat |= GMT_EOF (-1);
|
||||
if (part (partition)->emark >= eod_hit)
|
||||
get->mt_gstat |= GMT_EOD (-1);
|
||||
if (part (partition)->emark >= eom_hit)
|
||||
|
@ -497,10 +497,10 @@ inode_t::get_all_locks_list ()
|
||||
wc[LOCK_OBJ_NAME_LEN] = L'\0';
|
||||
short flags = wcstol (wc, &endptr, 16);
|
||||
if ((flags & ~(F_FLOCK | F_POSIX)) != 0
|
||||
|| (flags & (F_FLOCK | F_POSIX) == (F_FLOCK | F_POSIX)))
|
||||
|| ((flags & (F_FLOCK | F_POSIX)) == (F_FLOCK | F_POSIX)))
|
||||
continue;
|
||||
short type = wcstol (endptr + 1, &endptr, 16);
|
||||
if (type != F_RDLCK && type != F_WRLCK || !endptr || *endptr != L'-')
|
||||
if (type != (F_RDLCK && type != F_WRLCK) || !endptr || *endptr != L'-')
|
||||
continue;
|
||||
_off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
|
||||
if (start < 0 || !endptr || *endptr != L'-')
|
||||
@ -1442,7 +1442,7 @@ flock (int fd, int operation)
|
||||
goto done;
|
||||
}
|
||||
res = cfd->lock (cmd, &fl);
|
||||
if (res == -1 && (get_errno () == EAGAIN) || (get_errno () == EACCES))
|
||||
if ((res == -1) && ((get_errno () == EAGAIN) || (get_errno () == EACCES)))
|
||||
set_errno (EWOULDBLOCK);
|
||||
done:
|
||||
syscall_printf ("%d = flock (%d, %d)", res, fd, operation);
|
||||
|
@ -191,29 +191,29 @@ find_first_notloaded_dll (path_conv& pc)
|
||||
PIMAGE_NT_HEADERS pExeNTHdr;
|
||||
pExeNTHdr = PEHeaderFromHModule (hm);
|
||||
|
||||
if (!pExeNTHdr)
|
||||
goto out;
|
||||
|
||||
DWORD importRVA;
|
||||
importRVA = pExeNTHdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||
if (!importRVA)
|
||||
goto out;
|
||||
|
||||
long delta = rvadelta (pExeNTHdr, importRVA);
|
||||
|
||||
// Convert imports RVA to a usable pointer
|
||||
PIMAGE_IMPORT_DESCRIPTOR pdfirst;
|
||||
pdfirst = rva (PIMAGE_IMPORT_DESCRIPTOR, hm, importRVA - delta);
|
||||
|
||||
// Iterate through each import descriptor, and redirect if appropriate
|
||||
for (PIMAGE_IMPORT_DESCRIPTOR pd = pdfirst; pd->FirstThunk; pd++)
|
||||
if (pExeNTHdr)
|
||||
{
|
||||
const char *lib = rva (PSTR, hm, pd->Name - delta);
|
||||
if (!LoadLibraryEx (lib, NULL, DONT_RESOLVE_DLL_REFERENCES
|
||||
| LOAD_LIBRARY_AS_DATAFILE))
|
||||
DWORD importRVA;
|
||||
importRVA = pExeNTHdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||
if (importRVA)
|
||||
{
|
||||
static char buf[NT_MAX_PATH];
|
||||
res = strcpy (buf, lib);
|
||||
long delta = rvadelta (pExeNTHdr, importRVA);
|
||||
|
||||
// Convert imports RVA to a usable pointer
|
||||
PIMAGE_IMPORT_DESCRIPTOR pdfirst;
|
||||
pdfirst = rva (PIMAGE_IMPORT_DESCRIPTOR, hm, importRVA - delta);
|
||||
|
||||
// Iterate through each import descriptor, and redirect if appropriate
|
||||
for (PIMAGE_IMPORT_DESCRIPTOR pd = pdfirst; pd->FirstThunk; pd++)
|
||||
{
|
||||
const char *lib = rva (PSTR, hm, pd->Name - delta);
|
||||
if (!LoadLibraryEx (lib, NULL, DONT_RESOLVE_DLL_REFERENCES
|
||||
| LOAD_LIBRARY_AS_DATAFILE))
|
||||
{
|
||||
static char buf[NT_MAX_PATH];
|
||||
res = strcpy (buf, lib);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,11 @@
|
||||
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
|
||||
|
||||
#ifdef REPLACE_GETOPT
|
||||
int opterr = 1; /* if error message should be printed */
|
||||
int optind = 1; /* index into parent argv vector */
|
||||
int optopt = '?'; /* character checked for validity */
|
||||
int optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
int __declspec(dllexport) opterr = 1; /* if error message should be printed */
|
||||
int __declspec(dllexport) optind = 1; /* index into parent argv vector */
|
||||
int __declspec(dllexport) optopt = '?';/* index into parent argv vector *//* character checked for validity */
|
||||
int __declspec(dllexport) optreset; /* reset getopt */
|
||||
char __declspec(dllexport) *optarg; /* argument associated with option */
|
||||
#endif
|
||||
|
||||
#define PRINT_ERROR ((opterr) && (*options != ':'))
|
||||
|
@ -325,7 +325,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
|
||||
*srch++ = 0;
|
||||
if (numAddresses < DIM(statp->nsaddr_list)) {
|
||||
DPRINTF(debug, "server \"%s\"\n", ap);
|
||||
statp->nsaddr_list[numAddresses].sin_addr.s_addr = cygwin_inet_addr(ap);
|
||||
statp->nsaddr_list[numAddresses].sin_addr.s_addr = cygwin_inet_addr((char *) ap);
|
||||
if ( statp->nsaddr_list[numAddresses].sin_addr.s_addr != 0 )
|
||||
numAddresses++;
|
||||
}
|
||||
@ -335,7 +335,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
|
||||
statp->nscount = numAddresses;
|
||||
}
|
||||
else /* Parse the search line */
|
||||
minires_get_search(list, statp);
|
||||
minires_get_search((char *) list, statp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1130,7 +1130,7 @@ msync (void *addr, size_t len, int flags)
|
||||
|
||||
if (((uintptr_t) addr % getpagesize ())
|
||||
|| (flags & ~(MS_ASYNC | MS_SYNC | MS_INVALIDATE))
|
||||
|| (flags & (MS_ASYNC | MS_SYNC) == (MS_ASYNC | MS_SYNC)))
|
||||
|| ((flags & (MS_ASYNC | MS_SYNC)) == (MS_ASYNC | MS_SYNC)))
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
goto out;
|
||||
|
@ -104,7 +104,7 @@ struct symlink_info
|
||||
muto NO_COPY cwdstuff::cwd_lock;
|
||||
|
||||
static const GUID GUID_shortcut
|
||||
= { 0x00021401L, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46 };
|
||||
= { 0x00021401L, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
|
||||
|
||||
enum {
|
||||
WSH_FLAG_IDLIST = 0x01, /* Contains an ITEMIDLIST. */
|
||||
@ -2775,22 +2775,24 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||
switch (what)
|
||||
{
|
||||
case CCP_POSIX_TO_WIN_A:
|
||||
p.check ((const char *) from,
|
||||
PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN
|
||||
| (relative ? PC_NOFULL : 0));
|
||||
if (p.error)
|
||||
return_with_errno (p.error);
|
||||
PUNICODE_STRING up = p.get_nt_native_path ();
|
||||
buf = tp.c_get ();
|
||||
sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR));
|
||||
/* Convert native path to standard DOS path. */
|
||||
if (!strncmp (buf, "\\??\\", 4))
|
||||
{
|
||||
buf += 4;
|
||||
if (buf[1] != ':') /* native UNC path */
|
||||
*(buf += 2) = '\\';
|
||||
}
|
||||
lsiz = strlen (buf) + 1;
|
||||
{
|
||||
p.check ((const char *) from,
|
||||
PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN
|
||||
| (relative ? PC_NOFULL : 0));
|
||||
if (p.error)
|
||||
return_with_errno (p.error);
|
||||
PUNICODE_STRING up = p.get_nt_native_path ();
|
||||
buf = tp.c_get ();
|
||||
sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR));
|
||||
/* Convert native path to standard DOS path. */
|
||||
if (!strncmp (buf, "\\??\\", 4))
|
||||
{
|
||||
buf += 4;
|
||||
if (buf[1] != ':') /* native UNC path */
|
||||
*(buf += 2) = '\\';
|
||||
}
|
||||
lsiz = strlen (buf) + 1;
|
||||
}
|
||||
break;
|
||||
case CCP_POSIX_TO_WIN_W:
|
||||
p.check ((const char *) from,
|
||||
|
@ -116,29 +116,29 @@ pipesync::pipesync (HANDLE f, DWORD is_reader):
|
||||
{
|
||||
ev = CreateEvent (&sec_none_nih, true, false, NULL);
|
||||
if (!ev)
|
||||
system_printf ("couldn't create synchronization event for non-cygwin pipe, %E");
|
||||
else
|
||||
{
|
||||
system_printf ("couldn't create synchronization event for non-cygwin pipe, %E");
|
||||
goto out;
|
||||
}
|
||||
debug_printf ("created thread synchronization event %p", ev);
|
||||
non_cygwin_h = f;
|
||||
reader = !!is_reader;
|
||||
ret_handle = NULL;
|
||||
debug_printf ("created thread synchronization event %p", ev);
|
||||
non_cygwin_h = f;
|
||||
reader = !!is_reader;
|
||||
ret_handle = NULL;
|
||||
|
||||
DWORD tid;
|
||||
HANDLE ht = CreateThread (&sec_none_nih, 0, pipe_handler, this, 0, &tid);
|
||||
DWORD tid;
|
||||
HANDLE ht = CreateThread (&sec_none_nih, 0, pipe_handler, this, 0, &tid);
|
||||
|
||||
if (!ht)
|
||||
goto out;
|
||||
CloseHandle (ht);
|
||||
if (!ht)
|
||||
goto out;
|
||||
CloseHandle (ht);
|
||||
|
||||
switch (WaitForSingleObject (ev, INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
default:
|
||||
system_printf ("WFSO failed waiting for synchronization event for non-cygwin pipe, %E");
|
||||
break;
|
||||
switch (WaitForSingleObject (ev, INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
default:
|
||||
system_printf ("WFSO failed waiting for synchronization event for non-cygwin pipe, %E");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -280,7 +280,7 @@ srandom(unsigned x)
|
||||
/* Avoid a compiler warning when we really want to get at the junk in
|
||||
an uninitialized variable. */
|
||||
static unsigned long
|
||||
dummy (unsigned long *x)
|
||||
dummy (unsigned volatile long *x)
|
||||
{
|
||||
return *x;
|
||||
}
|
||||
|
@ -238,22 +238,28 @@ getace (__aclent32_t &acl, int type, int id, DWORD win_ace_mask,
|
||||
acl.a_id = id;
|
||||
|
||||
if ((win_ace_mask & FILE_READ_BITS) && !(acl.a_perm & (S_IROTH | DENY_R)))
|
||||
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
|
||||
acl.a_perm |= S_IROTH;
|
||||
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
|
||||
acl.a_perm |= DENY_R;
|
||||
{
|
||||
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
|
||||
acl.a_perm |= S_IROTH;
|
||||
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
|
||||
acl.a_perm |= DENY_R;
|
||||
}
|
||||
|
||||
if ((win_ace_mask & FILE_WRITE_BITS) && !(acl.a_perm & (S_IWOTH | DENY_W)))
|
||||
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
|
||||
acl.a_perm |= S_IWOTH;
|
||||
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
|
||||
acl.a_perm |= DENY_W;
|
||||
{
|
||||
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
|
||||
acl.a_perm |= S_IWOTH;
|
||||
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
|
||||
acl.a_perm |= DENY_W;
|
||||
}
|
||||
|
||||
if ((win_ace_mask & FILE_EXEC_BITS) && !(acl.a_perm & (S_IXOTH | DENY_X)))
|
||||
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
|
||||
acl.a_perm |= S_IXOTH;
|
||||
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
|
||||
acl.a_perm |= DENY_X;
|
||||
{
|
||||
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
|
||||
acl.a_perm |= S_IXOTH;
|
||||
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
|
||||
acl.a_perm |= DENY_X;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -798,13 +798,14 @@ create_token (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
|
||||
{
|
||||
/* Switching user context to SYSTEM doesn't inherit the authentication
|
||||
id of the user account running current process. */
|
||||
if (usersid != well_known_system_sid)
|
||||
if (!GetTokenInformation (hProcToken, TokenStatistics,
|
||||
&stats, sizeof stats, &size))
|
||||
debug_printf
|
||||
("GetTokenInformation(hProcToken, TokenStatistics), %E");
|
||||
else
|
||||
auth_luid = stats.AuthenticationId;
|
||||
if (usersid == well_known_system_sid)
|
||||
/* nothing to do */;
|
||||
else if (!GetTokenInformation (hProcToken, TokenStatistics,
|
||||
&stats, sizeof stats, &size))
|
||||
debug_printf
|
||||
("GetTokenInformation(hProcToken, TokenStatistics), %E");
|
||||
else
|
||||
auth_luid = stats.AuthenticationId;
|
||||
|
||||
/* Retrieving current processes group list to be able to inherit
|
||||
some important well known group sids. */
|
||||
@ -1103,8 +1104,10 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
|
||||
|
||||
authinf->checksum = CYGWIN_VERSION_MAGIC (CYGWIN_VERSION_DLL_MAJOR,
|
||||
CYGWIN_VERSION_DLL_MINOR);
|
||||
PDWORD csp = (PDWORD) &authinf->username;
|
||||
PDWORD csp_end = (PDWORD) ((PBYTE) authinf + authinf_size);
|
||||
PDWORD csp;
|
||||
PDWORD csp_end;
|
||||
csp = (PDWORD) &authinf->username;
|
||||
csp_end = (PDWORD) ((PBYTE) authinf + authinf_size);
|
||||
while (csp < csp_end)
|
||||
authinf->checksum += *csp++;
|
||||
|
||||
|
@ -506,7 +506,7 @@ out:
|
||||
fh->get_name ());
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
#if 0
|
||||
/* FIXME: This code is not quite correct. There's no better solution
|
||||
so far but to make simple assumptions based on WriteQuotaAvailable. */
|
||||
|
||||
@ -531,7 +531,7 @@ out:
|
||||
that. This means that a pipe could still block since you could
|
||||
be trying to write more to the pipe than is available in the
|
||||
buffer but that is the hazard of select(). */
|
||||
else if (fpli.WriteQuotaAvailable = (fpli.OutboundQuota - fpli.ReadDataAvailable))
|
||||
else if ((fpli.WriteQuotaAvailable = (fpli.OutboundQuota - fpli.ReadDataAvailable)))
|
||||
{
|
||||
select_printf ("%s, ready for write: size %lu, avail %lu",
|
||||
fh->get_name (),
|
||||
|
@ -974,7 +974,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
|
||||
{
|
||||
const char *p;
|
||||
bool exeext = ascii_strcasematch (ext, ".exe");
|
||||
if (exeext && real_path.iscygexec () || ascii_strcasematch (ext, ".bat"))
|
||||
if ((exeext && real_path.iscygexec ()) || ascii_strcasematch (ext, ".bat"))
|
||||
return 0;
|
||||
if (!*ext && ((p = ext - 4) > real_path.get_win32 ())
|
||||
&& (ascii_strcasematch (p, ".bat") || ascii_strcasematch (p, ".cmd")
|
||||
|
@ -3517,14 +3517,13 @@ popen (const char *command, const char *in_type)
|
||||
fcntl64 (stdwhat, F_SETFD, state);
|
||||
}
|
||||
|
||||
if (pid < 0)
|
||||
goto err;
|
||||
close (other_fd);
|
||||
|
||||
fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd];
|
||||
fh->set_popen_pid (pid);
|
||||
|
||||
return fp;
|
||||
if (pid >= 0)
|
||||
{
|
||||
close (other_fd);
|
||||
fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd];
|
||||
fh->set_popen_pid (pid);
|
||||
return fp;
|
||||
}
|
||||
|
||||
err:
|
||||
int save_errno = get_errno ();
|
||||
|
@ -81,11 +81,12 @@ tty::init_session ()
|
||||
|
||||
if (NOTSTATE (myself, PID_USETTY))
|
||||
return;
|
||||
if (myself->ctty == -1)
|
||||
if (NOTSTATE (myself, PID_CYGPARENT))
|
||||
myself->ctty = cygwin_shared->tty.attach (myself->ctty);
|
||||
else
|
||||
return;
|
||||
if (myself->ctty != -1)
|
||||
/* nothing to do */;
|
||||
else if (NOTSTATE (myself, PID_CYGPARENT))
|
||||
myself->ctty = cygwin_shared->tty.attach (myself->ctty);
|
||||
else
|
||||
return;
|
||||
if (myself->ctty == -1)
|
||||
termios_printf ("Can't attach to tty");
|
||||
}
|
||||
|
@ -577,8 +577,7 @@ pwdgrp::load (const wchar_t *rel_path)
|
||||
goto out;
|
||||
}
|
||||
buf[fsi.EndOfFile.LowPart] = '\0';
|
||||
char *eptr = buf;
|
||||
while ((eptr = add_line (eptr)))
|
||||
for (char *eptr = buf; (eptr = add_line (eptr)); )
|
||||
continue;
|
||||
debug_printf ("%W curr_lines %d", rel_path, curr_lines);
|
||||
res = succeeded;
|
||||
|
Loading…
x
Reference in New Issue
Block a user