* 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:
Christopher Faylor 2008-09-11 04:34:24 +00:00
parent 0b840b0009
commit 7b9e380f03
29 changed files with 366 additions and 309 deletions

View File

@ -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> 2008-08-27 Christopher Faylor <me+cygwin@cgf.cx>
* fhandler_tty.cc (close_maybe): Check for both types of invalid handle * fhandler_tty.cc (close_maybe): Check for both types of invalid handle

View File

@ -244,14 +244,15 @@ _crealloc (void *ptr, unsigned size)
inline static void * inline static void *
creturn (cygheap_types x, cygheap_entry * c, unsigned len, const char *fn = NULL) creturn (cygheap_types x, cygheap_entry * c, unsigned len, const char *fn = NULL)
{ {
if (!c) if (c)
if (fn) /* nothing to do */;
api_fatal ("%s would have returned NULL", fn); else if (fn)
else api_fatal ("%s would have returned NULL", fn);
{ else
set_errno (ENOMEM); {
return NULL; set_errno (ENOMEM);
} return NULL;
}
c->type = x; c->type = x;
char *cend = ((char *) c + sizeof (*c) + len); char *cend = ((char *) c + sizeof (*c) + len);
if (cygheap_max < cend) if (cygheap_max < cend)

View File

@ -104,9 +104,6 @@ extern "C"
}; };
bool ignore_case_with_glob; bool ignore_case_with_glob;
int __declspec (dllexport) _check_for_executable = true; int __declspec (dllexport) _check_for_executable = true;
#ifdef DEBUGGING
int pinger;
#endif
}; };
int NO_COPY __api_fatal_exit_val = 1; int NO_COPY __api_fatal_exit_val = 1;

View File

@ -79,7 +79,6 @@ void __stdcall modify_handle (const char *, int, HANDLE, const char *, bool)
__attribute__ ((regparm (3))); __attribute__ ((regparm (3)));
void setclexec (HANDLE, HANDLE, bool); void setclexec (HANDLE, HANDLE, bool);
void debug_fixup_after_fork_exec (); void debug_fixup_after_fork_exec ();
extern int pinger;
struct handle_list struct handle_list
{ {

View File

@ -269,7 +269,7 @@ release_upto (const PWCHAR name, DWORD here)
(((void *) start < cygheap->user_heap.base (((void *) start < cygheap->user_heap.base
|| (void *) start > cygheap->user_heap.top) && || (void *) start > cygheap->user_heap.top) &&
((void *) start < (void *) cygheap ((void *) start < (void *) cygheap
| (void *) start > (void *) ((char *) cygheap + CYGHEAPSIZE))))) || (void *) start > (void *) ((char *) cygheap + CYGHEAPSIZE)))))
continue; continue;
if (!VirtualFree ((void *) start, 0, MEM_RELEASE)) if (!VirtualFree ((void *) start, 0, MEM_RELEASE))
api_fatal ("couldn't release memory %p(%d) for '%W' alignment, %E\n", api_fatal ("couldn't release memory %p(%d) for '%W' alignment, %E\n",

View File

@ -853,124 +853,117 @@ handle_to_fn (HANDLE h, char *posix_fn)
NtQueryObject (h, ObjectNameInformation, &dummy_oni, sizeof (dummy_oni), &len); NtQueryObject (h, ObjectNameInformation, &dummy_oni, sizeof (dummy_oni), &len);
if (!len) if (!len)
debug_printf ("NtQueryObject failed 1");
else
{ {
debug_printf ("NtQueryObject failed 1"); OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) alloca (len + sizeof (WCHAR));
goto unknown; NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, len, NULL);
}
OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) alloca (len + sizeof (WCHAR)); if (!NT_SUCCESS (res))
NTSTATUS res = NtQueryObject (h, ObjectNameInformation, ntfn, len, NULL); debug_printf ("NtQueryObject failed 2");
// NT seems to do this on an unopened file
if (!NT_SUCCESS (res)) else if (!ntfn->Name.Buffer)
{ debug_printf ("nt->Name.Buffer == NULL");
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';
else else
{ {
if (maxmatchdos[n - 1] == L'\\') WCHAR *w32 = ntfn->Name.Buffer;
n--; size_t w32len = ntfn->Name.Length / sizeof (WCHAR);
w32 += maxmatchlen - n; w32[w32len] = L'\0';
ch = L'\\';
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); strcpy (posix_fn, unknown_file);
return false; return false;
} }

View File

@ -1665,7 +1665,7 @@ fhandler_base::setup_overlapped ()
{ {
OVERLAPPED *ov = get_overlapped (); OVERLAPPED *ov = get_overlapped ();
memset (ov, 0, sizeof (*ov)); 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 void
@ -1707,9 +1707,9 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
if (&_my_tls == _main_tls) if (&_my_tls == _main_tls)
w4[n++] = signal_arrived; w4[n++] = signal_arrived;
HANDLE h = writing ? get_output_handle () : get_handle (); HANDLE h = writing ? get_output_handle () : get_handle ();
DWORD res = WaitForMultipleObjects (n, w4, false, INFINITE); DWORD wres = WaitForMultipleObjects (n, w4, false, INFINITE);
err = 0; err = 0;
switch (res) switch (wres)
{ {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
debug_printf ("normal read"); debug_printf ("normal read");

View File

@ -261,7 +261,7 @@ fhandler_console::read (void *pv, size_t& buflen)
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */ /* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
if (input_rec.Event.KeyEvent.bKeyDown && if (input_rec.Event.KeyEvent.bKeyDown &&
virtual_key_code == VK_SCROLL && 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); 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 /* ScrollConsoleScreenBuffer on Windows 95 is buggy - when scroll distance
* is more than half of screen, filling doesn't work as expected */ * is more than half of screen, filling doesn't work as expected */
if (sr1.Top != sr1.Bottom) if (sr1.Top == sr1.Bottom)
if (dest.Y <= sr1.Top) /* forward scroll */ /* nothing to do */;
clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom); else if (dest.Y <= sr1.Top) /* forward scroll */
else /* reverse scroll */ clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom);
clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1); else /* reverse scroll */
clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1);
} }
int int
@ -895,12 +896,13 @@ dev_console::set_color (HANDLE h)
win_bg |= BACKGROUND_INTENSITY; win_bg |= BACKGROUND_INTENSITY;
if (intensity == INTENSITY_INVISIBLE) if (intensity == INTENSITY_INVISIBLE)
win_fg = win_bg; 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! */ /* apply foreground intensity only in non-reverse mode! */
if (reverse) else if (reverse)
win_bg |= BACKGROUND_INTENSITY; win_bg |= BACKGROUND_INTENSITY;
else else
win_fg |= FOREGROUND_INTENSITY; win_fg |= FOREGROUND_INTENSITY;
current_win32_attr = win_fg | win_bg; current_win32_attr = win_fg | win_bg;
if (h) if (h)

View File

@ -350,11 +350,11 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
pc.file_attributes (fai_buf.fai.BasicInformation.FileAttributes); pc.file_attributes (fai_buf.fai.BasicInformation.FileAttributes);
return fstat_helper (buf, return fstat_helper (buf,
fai_buf.fai.BasicInformation.ChangeTime.QuadPart fai_buf.fai.BasicInformation.ChangeTime.QuadPart
? *(FILETIME *) &fai_buf.fai.BasicInformation.ChangeTime ? *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.ChangeTime
: *(FILETIME *) &fai_buf.fai.BasicInformation.LastWriteTime, : *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
*(FILETIME *) &fai_buf.fai.BasicInformation.LastAccessTime, *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastAccessTime,
*(FILETIME *) &fai_buf.fai.BasicInformation.LastWriteTime, *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
*(FILETIME *) &fai_buf.fai.BasicInformation.CreationTime, *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.CreationTime,
get_dev (), get_dev (),
fai_buf.fai.StandardInformation.EndOfFile.QuadPart, fai_buf.fai.StandardInformation.EndOfFile.QuadPart,
fai_buf.fai.StandardInformation.AllocationSize.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); pc.file_attributes (fdi_buf.fdi.FileAttributes);
return fstat_helper (buf, return fstat_helper (buf,
fdi_buf.fdi.ChangeTime.QuadPart ? fdi_buf.fdi.ChangeTime.QuadPart ?
*(FILETIME *) &fdi_buf.fdi.ChangeTime : *(FILETIME *) (void *) &fdi_buf.fdi.ChangeTime :
*(FILETIME *) &fdi_buf.fdi.LastWriteTime, *(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime,
*(FILETIME *) &fdi_buf.fdi.LastAccessTime, *(FILETIME *) (void *) &fdi_buf.fdi.LastAccessTime,
*(FILETIME *) &fdi_buf.fdi.LastWriteTime, *(FILETIME *) (void *) &fdi_buf.fdi.LastWriteTime,
*(FILETIME *) &fdi_buf.fdi.CreationTime, *(FILETIME *) (void *) &fdi_buf.fdi.CreationTime,
pc.fs_serial_number (), pc.fs_serial_number (),
fdi_buf.fdi.EndOfFile.QuadPart, fdi_buf.fdi.EndOfFile.QuadPart,
fdi_buf.fdi.AllocationSize.QuadPart, fdi_buf.fdi.AllocationSize.QuadPart,
@ -434,10 +434,10 @@ too_bad:
/* Arbitrary value: 2006-12-01 */ /* Arbitrary value: 2006-12-01 */
RtlSecondsSince1970ToTime (1164931200L, &ft); RtlSecondsSince1970ToTime (1164931200L, &ft);
return fstat_helper (buf, return fstat_helper (buf,
*(FILETIME *) &ft, *(FILETIME *) (void *) &ft,
*(FILETIME *) &ft, *(FILETIME *) (void *) &ft,
*(FILETIME *) &ft, *(FILETIME *) (void *) &ft,
*(FILETIME *) &ft, *(FILETIME *) (void *) &ft,
0, 0,
0ULL, 0ULL,
-1LL, -1LL,

View File

@ -1007,24 +1007,25 @@ fhandler_dev_dsp::write (const void *ptr, size_t len)
int len_s = len; int len_s = len;
const char *ptr_s = static_cast <const char *> (ptr); const char *ptr_s = static_cast <const char *> (ptr);
if (!audio_out_) if (audio_out_)
if (IS_WRITE ()) /* nothing to do */;
{ else if (IS_WRITE ())
debug_printf ("Allocating"); {
if (!(audio_out_ = new Audio_out)) debug_printf ("Allocating");
return -1; if (!(audio_out_ = new Audio_out))
/* 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; 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. /* Open audio device properly with callbacks.
Private parameters were set in call to parsewav. 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) if ((fhandler_dev_dsp *) archetype != this)
return ((fhandler_dev_dsp *)archetype)->read(ptr, len); return ((fhandler_dev_dsp *)archetype)->read(ptr, len);
if (!audio_in_) if (audio_in_)
if (IS_READ ()) /* nothing to do */;
{ else if (IS_READ ())
debug_printf ("Allocating"); {
if (!(audio_in_ = new Audio_in)) debug_printf ("Allocating");
{ if (!(audio_in_ = new Audio_in))
len = (size_t)-1; {
return; len = (size_t)-1;
} return;
audio_in_->setconvert (audioformat_); }
} audio_in_->setconvert (audioformat_);
else }
{ else
len = (size_t)-1; {
set_errno (EBADF); // device was opened for write? len = (size_t)-1;
return; set_errno (EBADF); // device was opened for write?
} return;
}
/* Open audio device properly with callbacks. /* Open audio device properly with callbacks.
This is a noop when there are successive reads in the same process */ This is a noop when there are successive reads in the same process */

View File

@ -34,7 +34,7 @@ fhandler_fifo::open_nonserver (const char *npname, unsigned low_flags,
DWORD mode = 0; DWORD mode = 0;
if (low_flags == O_RDONLY) if (low_flags == O_RDONLY)
mode = GENERIC_READ; mode = GENERIC_READ;
else if (low_flags = O_WRONLY) else if (low_flags == O_WRONLY)
mode = GENERIC_WRITE; mode = GENERIC_WRITE;
else else
mode = GENERIC_READ | GENERIC_WRITE; mode = GENERIC_READ | GENERIC_WRITE;
@ -131,11 +131,16 @@ fhandler_fifo::wait (bool iswrite)
switch (wait_state) switch (wait_state)
{ {
case fifo_wait_for_client: case fifo_wait_for_client:
bool res = ConnectNamedPipe (get_handle (), get_overlapped ()); {
DWORD dummy_bytes; bool res = ConnectNamedPipe (get_handle (), get_overlapped ());
if (res || GetLastError () == ERROR_PIPE_CONNECTED) DWORD dummy_bytes;
return true; if (res || GetLastError () == ERROR_PIPE_CONNECTED)
return wait_overlapped (res, iswrite, &dummy_bytes); 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: default:
break; break;
} }

View File

@ -931,7 +931,7 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
{ {
++*vmrss; ++*vmrss;
unsigned flags = mwsl->WorkingSetList[i] & 0x0FFF; 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; ++*vmlib;
else if (flags & WSLE_PAGE_SHAREABLE) else if (flags & WSLE_PAGE_SHAREABLE)
++*vmshare; ++*vmshare;

View File

@ -408,9 +408,9 @@ fhandler_socket::af_local_set_secret (char *buf)
#define LOCK_EVENTS WaitForSingleObject (wsock_mtx, INFINITE) #define LOCK_EVENTS WaitForSingleObject (wsock_mtx, INFINITE)
#define UNLOCK_EVENTS ReleaseMutex (wsock_mtx) #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; static HANDLE wsa_slot_mtx;
@ -1091,7 +1091,7 @@ fhandler_socket::listen (int backlog)
sin6_family: AF_INET6, sin6_family: AF_INET6,
sin6_port: 0, sin6_port: 0,
sin6_flowinfo: 0, sin6_flowinfo: 0,
sin6_addr: IN6ADDR_ANY_INIT, sin6_addr: {{IN6ADDR_ANY_INIT}},
sin6_scope_id: 0 sin6_scope_id: 0
}; };
if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6)) if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6))

View File

@ -801,11 +801,12 @@ mtinfo_drive::get_status (HANDLE mt, struct mtget *get)
get->mt_fileno = part (partition)->file; get->mt_fileno = part (partition)->file;
get->mt_blkno = part (partition)->fblock; get->mt_blkno = part (partition)->fblock;
if (get->mt_blkno == 0) if (get->mt_blkno != 0)
if (get->mt_fileno == 0) /* nothing to do */;
get->mt_gstat |= GMT_BOT (-1); else if (get->mt_fileno == 0)
else get->mt_gstat |= GMT_BOT (-1);
get->mt_gstat |= GMT_EOF (-1); else
get->mt_gstat |= GMT_EOF (-1);
if (part (partition)->emark >= eod_hit) if (part (partition)->emark >= eod_hit)
get->mt_gstat |= GMT_EOD (-1); get->mt_gstat |= GMT_EOD (-1);
if (part (partition)->emark >= eom_hit) if (part (partition)->emark >= eom_hit)

View File

@ -497,10 +497,10 @@ inode_t::get_all_locks_list ()
wc[LOCK_OBJ_NAME_LEN] = L'\0'; wc[LOCK_OBJ_NAME_LEN] = L'\0';
short flags = wcstol (wc, &endptr, 16); short flags = wcstol (wc, &endptr, 16);
if ((flags & ~(F_FLOCK | F_POSIX)) != 0 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; continue;
short type = wcstol (endptr + 1, &endptr, 16); 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; continue;
_off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16); _off64_t start = (_off64_t) wcstoull (endptr + 1, &endptr, 16);
if (start < 0 || !endptr || *endptr != L'-') if (start < 0 || !endptr || *endptr != L'-')
@ -1442,7 +1442,7 @@ flock (int fd, int operation)
goto done; goto done;
} }
res = cfd->lock (cmd, &fl); 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); set_errno (EWOULDBLOCK);
done: done:
syscall_printf ("%d = flock (%d, %d)", res, fd, operation); syscall_printf ("%d = flock (%d, %d)", res, fd, operation);

View File

@ -191,29 +191,29 @@ find_first_notloaded_dll (path_conv& pc)
PIMAGE_NT_HEADERS pExeNTHdr; PIMAGE_NT_HEADERS pExeNTHdr;
pExeNTHdr = PEHeaderFromHModule (hm); pExeNTHdr = PEHeaderFromHModule (hm);
if (!pExeNTHdr) 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++)
{ {
const char *lib = rva (PSTR, hm, pd->Name - delta); DWORD importRVA;
if (!LoadLibraryEx (lib, NULL, DONT_RESOLVE_DLL_REFERENCES importRVA = pExeNTHdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
| LOAD_LIBRARY_AS_DATAFILE)) if (importRVA)
{ {
static char buf[NT_MAX_PATH]; long delta = rvadelta (pExeNTHdr, importRVA);
res = strcpy (buf, lib);
// 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);
}
}
} }
} }

View File

@ -58,11 +58,11 @@
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */ #define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
#ifdef REPLACE_GETOPT #ifdef REPLACE_GETOPT
int opterr = 1; /* if error message should be printed */ int __declspec(dllexport) opterr = 1; /* if error message should be printed */
int optind = 1; /* index into parent argv vector */ int __declspec(dllexport) optind = 1; /* index into parent argv vector */
int optopt = '?'; /* character checked for validity */ int __declspec(dllexport) optopt = '?';/* index into parent argv vector *//* character checked for validity */
int optreset; /* reset getopt */ int __declspec(dllexport) optreset; /* reset getopt */
char *optarg; /* argument associated with option */ char __declspec(dllexport) *optarg; /* argument associated with option */
#endif #endif
#define PRINT_ERROR ((opterr) && (*options != ':')) #define PRINT_ERROR ((opterr) && (*options != ':'))

View File

@ -325,7 +325,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
*srch++ = 0; *srch++ = 0;
if (numAddresses < DIM(statp->nsaddr_list)) { if (numAddresses < DIM(statp->nsaddr_list)) {
DPRINTF(debug, "server \"%s\"\n", ap); 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 ) if ( statp->nsaddr_list[numAddresses].sin_addr.s_addr != 0 )
numAddresses++; numAddresses++;
} }
@ -335,7 +335,7 @@ static void get_registry_dns_items(HKEY hKey, LPCTSTR KeyValue,
statp->nscount = numAddresses; statp->nscount = numAddresses;
} }
else /* Parse the search line */ else /* Parse the search line */
minires_get_search(list, statp); minires_get_search((char *) list, statp);
} }
return; return;
} }

View File

@ -1130,7 +1130,7 @@ msync (void *addr, size_t len, int flags)
if (((uintptr_t) addr % getpagesize ()) if (((uintptr_t) addr % getpagesize ())
|| (flags & ~(MS_ASYNC | MS_SYNC | MS_INVALIDATE)) || (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); set_errno (EINVAL);
goto out; goto out;

View File

@ -104,7 +104,7 @@ struct symlink_info
muto NO_COPY cwdstuff::cwd_lock; muto NO_COPY cwdstuff::cwd_lock;
static const GUID GUID_shortcut 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 { enum {
WSH_FLAG_IDLIST = 0x01, /* Contains an ITEMIDLIST. */ 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) switch (what)
{ {
case CCP_POSIX_TO_WIN_A: case CCP_POSIX_TO_WIN_A:
p.check ((const char *) from, {
PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN p.check ((const char *) from,
| (relative ? PC_NOFULL : 0)); PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN
if (p.error) | (relative ? PC_NOFULL : 0));
return_with_errno (p.error); if (p.error)
PUNICODE_STRING up = p.get_nt_native_path (); return_with_errno (p.error);
buf = tp.c_get (); PUNICODE_STRING up = p.get_nt_native_path ();
sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR)); buf = tp.c_get ();
/* Convert native path to standard DOS path. */ sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR));
if (!strncmp (buf, "\\??\\", 4)) /* Convert native path to standard DOS path. */
{ if (!strncmp (buf, "\\??\\", 4))
buf += 4; {
if (buf[1] != ':') /* native UNC path */ buf += 4;
*(buf += 2) = '\\'; if (buf[1] != ':') /* native UNC path */
} *(buf += 2) = '\\';
lsiz = strlen (buf) + 1; }
lsiz = strlen (buf) + 1;
}
break; break;
case CCP_POSIX_TO_WIN_W: case CCP_POSIX_TO_WIN_W:
p.check ((const char *) from, p.check ((const char *) from,

View File

@ -116,29 +116,29 @@ pipesync::pipesync (HANDLE f, DWORD is_reader):
{ {
ev = CreateEvent (&sec_none_nih, true, false, NULL); ev = CreateEvent (&sec_none_nih, true, false, NULL);
if (!ev) 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"); debug_printf ("created thread synchronization event %p", ev);
goto out; non_cygwin_h = f;
} reader = !!is_reader;
debug_printf ("created thread synchronization event %p", ev); ret_handle = NULL;
non_cygwin_h = f;
reader = !!is_reader;
ret_handle = NULL;
DWORD tid; DWORD tid;
HANDLE ht = CreateThread (&sec_none_nih, 0, pipe_handler, this, 0, &tid); HANDLE ht = CreateThread (&sec_none_nih, 0, pipe_handler, this, 0, &tid);
if (!ht) if (!ht)
goto out; goto out;
CloseHandle (ht); CloseHandle (ht);
switch (WaitForSingleObject (ev, INFINITE)) switch (WaitForSingleObject (ev, INFINITE))
{ {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
break; break;
default: default:
system_printf ("WFSO failed waiting for synchronization event for non-cygwin pipe, %E"); system_printf ("WFSO failed waiting for synchronization event for non-cygwin pipe, %E");
break; break;
}
} }
out: out:

View File

@ -280,7 +280,7 @@ srandom(unsigned x)
/* Avoid a compiler warning when we really want to get at the junk in /* Avoid a compiler warning when we really want to get at the junk in
an uninitialized variable. */ an uninitialized variable. */
static unsigned long static unsigned long
dummy (unsigned long *x) dummy (unsigned volatile long *x)
{ {
return *x; return *x;
} }

View File

@ -238,22 +238,28 @@ getace (__aclent32_t &acl, int type, int id, DWORD win_ace_mask,
acl.a_id = id; acl.a_id = id;
if ((win_ace_mask & FILE_READ_BITS) && !(acl.a_perm & (S_IROTH | DENY_R))) 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; if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE) acl.a_perm |= S_IROTH;
acl.a_perm |= DENY_R; 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_mask & FILE_WRITE_BITS) && !(acl.a_perm & (S_IWOTH | DENY_W)))
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE) {
acl.a_perm |= S_IWOTH; if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE) acl.a_perm |= S_IWOTH;
acl.a_perm |= DENY_W; 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_mask & FILE_EXEC_BITS) && !(acl.a_perm & (S_IXOTH | DENY_X)))
if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE) {
acl.a_perm |= S_IXOTH; if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
else if (win_ace_type == ACCESS_DENIED_ACE_TYPE) acl.a_perm |= S_IXOTH;
acl.a_perm |= DENY_X; else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
acl.a_perm |= DENY_X;
}
} }
int int

View File

@ -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 /* Switching user context to SYSTEM doesn't inherit the authentication
id of the user account running current process. */ id of the user account running current process. */
if (usersid != well_known_system_sid) if (usersid == well_known_system_sid)
if (!GetTokenInformation (hProcToken, TokenStatistics, /* nothing to do */;
&stats, sizeof stats, &size)) else if (!GetTokenInformation (hProcToken, TokenStatistics,
debug_printf &stats, sizeof stats, &size))
("GetTokenInformation(hProcToken, TokenStatistics), %E"); debug_printf
else ("GetTokenInformation(hProcToken, TokenStatistics), %E");
auth_luid = stats.AuthenticationId; else
auth_luid = stats.AuthenticationId;
/* Retrieving current processes group list to be able to inherit /* Retrieving current processes group list to be able to inherit
some important well known group sids. */ 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, authinf->checksum = CYGWIN_VERSION_MAGIC (CYGWIN_VERSION_DLL_MAJOR,
CYGWIN_VERSION_DLL_MINOR); CYGWIN_VERSION_DLL_MINOR);
PDWORD csp = (PDWORD) &authinf->username; PDWORD csp;
PDWORD csp_end = (PDWORD) ((PBYTE) authinf + authinf_size); PDWORD csp_end;
csp = (PDWORD) &authinf->username;
csp_end = (PDWORD) ((PBYTE) authinf + authinf_size);
while (csp < csp_end) while (csp < csp_end)
authinf->checksum += *csp++; authinf->checksum += *csp++;

View File

@ -506,7 +506,7 @@ out:
fh->get_name ()); fh->get_name ());
else else
{ {
#if 1 #if 0
/* FIXME: This code is not quite correct. There's no better solution /* FIXME: This code is not quite correct. There's no better solution
so far but to make simple assumptions based on WriteQuotaAvailable. */ 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 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 be trying to write more to the pipe than is available in the
buffer but that is the hazard of select(). */ 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", select_printf ("%s, ready for write: size %lu, avail %lu",
fh->get_name (), fh->get_name (),

View File

@ -974,7 +974,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
{ {
const char *p; const char *p;
bool exeext = ascii_strcasematch (ext, ".exe"); 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; return 0;
if (!*ext && ((p = ext - 4) > real_path.get_win32 ()) if (!*ext && ((p = ext - 4) > real_path.get_win32 ())
&& (ascii_strcasematch (p, ".bat") || ascii_strcasematch (p, ".cmd") && (ascii_strcasematch (p, ".bat") || ascii_strcasematch (p, ".cmd")

View File

@ -3517,14 +3517,13 @@ popen (const char *command, const char *in_type)
fcntl64 (stdwhat, F_SETFD, state); fcntl64 (stdwhat, F_SETFD, state);
} }
if (pid < 0) if (pid >= 0)
goto err; {
close (other_fd); close (other_fd);
fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd];
fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fd]; fh->set_popen_pid (pid);
fh->set_popen_pid (pid); return fp;
}
return fp;
err: err:
int save_errno = get_errno (); int save_errno = get_errno ();

View File

@ -81,11 +81,12 @@ tty::init_session ()
if (NOTSTATE (myself, PID_USETTY)) if (NOTSTATE (myself, PID_USETTY))
return; return;
if (myself->ctty == -1) if (myself->ctty != -1)
if (NOTSTATE (myself, PID_CYGPARENT)) /* nothing to do */;
myself->ctty = cygwin_shared->tty.attach (myself->ctty); else if (NOTSTATE (myself, PID_CYGPARENT))
else myself->ctty = cygwin_shared->tty.attach (myself->ctty);
return; else
return;
if (myself->ctty == -1) if (myself->ctty == -1)
termios_printf ("Can't attach to tty"); termios_printf ("Can't attach to tty");
} }

View File

@ -577,8 +577,7 @@ pwdgrp::load (const wchar_t *rel_path)
goto out; goto out;
} }
buf[fsi.EndOfFile.LowPart] = '\0'; buf[fsi.EndOfFile.LowPart] = '\0';
char *eptr = buf; for (char *eptr = buf; (eptr = add_line (eptr)); )
while ((eptr = add_line (eptr)))
continue; continue;
debug_printf ("%W curr_lines %d", rel_path, curr_lines); debug_printf ("%W curr_lines %d", rel_path, curr_lines);
res = succeeded; res = succeeded;