static int finishParentHostCommandStream (HostCommandStream *hcs, void *data) { int *local = getParentDescriptor(hcs); int *remote = getChildDescriptor(hcs); close(*remote); *remote = -1; if (!finishHostCommandStream(hcs, *local)) return 0; *local = -1; return 1; }
static int finishParentHostCommandStream (HostCommandStream *hcs, void *data) { { HANDLE *handle = getParentHandle(hcs); int mode = hcs->isInput? O_WRONLY: O_RDONLY; int fileDescriptor; if ((fileDescriptor = _open_osfhandle((intptr_t)*handle, mode)) == -1) { logSystemError("_open_osfhandle"); return 0; } *handle = INVALID_HANDLE_VALUE; if (!finishHostCommandStream(hcs, fileDescriptor)) { _close(fileDescriptor); return 0; } } closeHandle(getChildHandle(hcs)); return 1; }