Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-01-05 09:48:57 +0300
committerChristopher Faylor <me@cgf.cx>2003-01-05 09:48:57 +0300
commit73293a0e82f5e5486df2810660d71098dbe8fe18 (patch)
tree069281f73e3b9ba499b319e2602c6a0d7fe4ee36
parent9c18893bfe782c34700c49d37344f2ad58c73958 (diff)
* pinfo.cc (_pinfo::commune_send): Use myself->lock rather than just lock whenunlabeled-1.74.4
leaving.
-rw-r--r--winsup/cygwin/pinfo.cc47
1 files changed, 28 insertions, 19 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index d59a0dada..b6c8fb281 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -323,18 +323,17 @@ _pinfo::commune_recv ()
/* __seterrno ();*/ // this is run from the signal thread, so don't set errno
goto out;
}
+
fhandler_fifo *fh = cygheap->fdtab.find_fifo ((ATOM) formic);
- if (!WriteFile (__tothem, &(fh->get_handle ()), sizeof (HANDLE), &nr, NULL))
+ HANDLE it[] = {(fh->get_handle ()), (fh->get_output_handle ())};
+
+ if (!WriteFile (__tothem, it, sizeof (it), &nr, NULL))
{
/*__seterrno ();*/ // this is run from the signal thread, so don't set errno
sigproc_printf ("WriteFile read handle failed, %E");
}
- if (!WriteFile (__tothem, &(fh->get_output_handle ()), sizeof (HANDLE), &nr, NULL))
- {
- /*__seterrno ();*/ // this is run from the signal thread, so don't set errno
- sigproc_printf ("WriteFile write handle failed, %E");
- }
+ (void) ReadFile (__fromthem, &nr, sizeof (nr), &nr, NULL);
break;
}
}
@@ -394,8 +393,11 @@ _pinfo::commune_send (DWORD code, ...)
case PICOM_FIFO:
{
int formic = va_arg (args, int);
- if (WriteFile (tothem, &formic, sizeof formic, &nr, NULL) != sizeof formic)
- goto err;
+ if (!WriteFile (tothem, &formic, sizeof formic, &nr, NULL) || nr != sizeof formic)
+ {
+ __seterrno ();
+ goto err;
+ }
break;
}
}
@@ -429,14 +431,14 @@ _pinfo::commune_send (DWORD code, ...)
}
size_t n;
- if (!ReadFile (fromthem, &n, sizeof n, &nr, NULL) || nr != sizeof n)
- {
- __seterrno ();
- goto err;
- }
switch (code)
{
case PICOM_CMDLINE:
+ if (!ReadFile (fromthem, &n, sizeof n, &nr, NULL) || nr != sizeof n)
+ {
+ __seterrno ();
+ goto err;
+ }
res.s = (char *) malloc (n);
char *p;
for (p = res.s; ReadFile (fromthem, p, n, &nr, NULL); p += nr)
@@ -449,11 +451,18 @@ _pinfo::commune_send (DWORD code, ...)
res.n = n;
break;
case PICOM_FIFO:
- if (n != sizeof (res.handles)
- || !ReadFile (fromthem, res.handles, sizeof (res.handles), &nr, NULL)
- || nr != n)
- goto err;
- break;
+ {
+ DWORD x = ReadFile (fromthem, res.handles, sizeof (res.handles), &nr, NULL);
+ WriteFile (tothem, &x, sizeof (x), &x, NULL);
+ if (!x)
+ goto err;
+ if (nr != sizeof (res.handles))
+ {
+ set_errno (EPIPE);
+ goto err;
+ }
+ break;
+ }
}
CloseHandle (tothem);
CloseHandle (fromthem);
@@ -472,7 +481,7 @@ err:
out:
myself->hello_pid = 0;
- LeaveCriticalSection (&lock);
+ LeaveCriticalSection (&myself->lock);
return res;
}