aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-03-21 17:41:40 +0000
committerChristopher Faylor <me@cgf.cx>2004-03-21 17:41:40 +0000
commitc795774c91303368f36369f7dac0d18aa25a5996 (patch)
tree8b670b7b945e6106fc46a72d294e20fdf05125c9 /winsup/cygwin/pinfo.cc
parent7f5a71079f098a9b45328fb86b68442774323c1d (diff)
downloadnewlib-c795774c91303368f36369f7dac0d18aa25a5996.zip
newlib-c795774c91303368f36369f7dac0d18aa25a5996.tar.gz
newlib-c795774c91303368f36369f7dac0d18aa25a5996.tar.bz2
* cygheap.cc (init_cheap): Add ability to specify minimal cygwin heap size when
debugging. (_csbrk): Report error in allocation to stderr. (ccalloc): Ditto. * dtable.cc (dtable::find_fifo): Remove use of atoms. * dtable.h (dtable::find_fifo): Ditto. * fhandler.h (fhandler_fifo): Ditto. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Ditto. (fhandler_fifo::set_use): Ditto. (fhandler_fifo::open_not_mine): Ditto. (fhandler_fifo::open): Ditto. * pinfo.cc (_pinfo::commune_recv): Ditto. (_pinfo::commune_send): Ditto.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc30
1 files changed, 23 insertions, 7 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index f467d7e..0ed7400 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -398,16 +398,31 @@ _pinfo::commune_recv ()
}
case PICOM_FIFO:
{
- int formic;
- if (!ReadFile (__fromthem, &formic, sizeof formic, &nr, NULL)
- || nr != sizeof formic)
+ char path[CYG_MAX_PATH + 1];
+ unsigned len;
+ if (!ReadFile (__fromthem, &len, sizeof len, &nr, NULL)
+ || nr != sizeof len)
+ {
+ /* __seterrno ();*/ // this is run from the signal thread, so don't set errno
+ goto out;
+ }
+ /* Get null-terminated path */
+ if (!ReadFile (__fromthem, path, len, &nr, NULL)
+ || nr != len)
{
/* __seterrno ();*/ // this is run from the signal thread, so don't set errno
goto out;
}
- fhandler_fifo *fh = cygheap->fdtab.find_fifo ((ATOM) formic);
- HANDLE it[] = {(fh->get_handle ()), (fh->get_output_handle ())};
+ fhandler_fifo *fh = cygheap->fdtab.find_fifo (path);
+ HANDLE it[2];
+ if (fh == NULL)
+ it[0] = it[1] = NULL;
+ else
+ {
+ it[0] = fh->get_handle ();
+ it[1] = fh->get_output_handle ();
+ }
if (!WriteFile (__tothem, it, sizeof (it), &nr, NULL))
{
@@ -474,8 +489,9 @@ _pinfo::commune_send (DWORD code, ...)
{
case PICOM_FIFO:
{
- int formic = va_arg (args, int);
- if (!WriteFile (tothem, &formic, sizeof formic, &nr, NULL) || nr != sizeof formic)
+ char *path = va_arg (args, char *);
+ size_t len = strlen (path) + 1;
+ if (!WriteFile (tothem, path, len, &nr, NULL) || nr != len)
{
__seterrno ();
goto err;