Changeset 2376 for trunk/src/kash/shfile.c
- Timestamp:
- Jan 13, 2010, 2:45:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shfile.c
r2312 r2376 548 548 if (hFile != INVALID_HANDLE_VALUE) 549 549 { 550 int fd2 = shfile_insert(pfdtab, (intptr_t)hFile, aStdHandles[i].fFlags, 0, i, "shtab_init"); 550 DWORD dwType = GetFileType(hFile); 551 unsigned fFlags = aStdHandles[i].fFlags; 552 unsigned fFlags2; 553 int fd2; 554 if (dwType == FILE_TYPE_CHAR) 555 fFlags2 = SHFILE_FLAGS_TTY; 556 else if (dwType == FILE_TYPE_PIPE) 557 fFlags2 = SHFILE_FLAGS_PIPE; 558 else 559 fFlags2 = SHFILE_FLAGS_FILE; 560 fd2 = shfile_insert(pfdtab, (intptr_t)hFile, fFlags, fFlags2, i, "shtab_init"); 551 561 assert(fd2 == i); (void)fd2; 552 562 if (fd2 != i) … … 588 598 589 599 shmtx_enter(&pfdtab->mtx, &tmp); 590 TRACE2((NULL, "shfile_fork_win: \n"));600 TRACE2((NULL, "shfile_fork_win: set=%d\n", set)); 591 601 592 602 i = pfdtab->size; … … 598 608 if (set) 599 609 TRACE2((NULL, " #%d: native=%#x oflags=%#x shflags=%#x\n", 600 i, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags, hFile));610 i, hFile, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags)); 601 611 if (!SetHandleInformation(hFile, HANDLE_FLAG_INHERIT, fFlag)) 602 612 { … … 612 622 { 613 623 if ( pfdtab->size > i 614 && pfdtab->tab[i].fd == 0)624 && pfdtab->tab[i].fd == i) 615 625 hndls[i] = pfdtab->tab[i].native; 616 626 else 617 627 hndls[i] = (intptr_t)INVALID_HANDLE_VALUE; 628 TRACE2((NULL, "shfile_fork_win: i=%d size=%d fd=%d native=%d hndls[%d]=%p\n", 629 i, pfdtab->size, pfdtab->tab[i].fd, pfdtab->tab[i].native, i, hndls[i])); 618 630 } 619 631 } … … 644 656 645 657 shmtx_enter(&pfdtab->mtx, &tmp); 646 TRACE2((NULL, "shfile_ fork_win:\n"));658 TRACE2((NULL, "shfile_exec_win: prepare=%p\n", prepare)); 647 659 648 660 count = pfdtab->size < (0x10000-4) / (1 + sizeof(HANDLE)) 649 661 ? pfdtab->size 650 662 : (0x10000-4) / (1 + sizeof(HANDLE)); 651 while (count > 3 && pfdtab->tab[count ].fd == -1)663 while (count > 3 && pfdtab->tab[count - 1].fd == -1) 652 664 count--; 653 665 … … 669 681 HANDLE hFile = (HANDLE)pfdtab->tab[i].native; 670 682 TRACE2((NULL, " #%d: native=%#x oflags=%#x shflags=%#x\n", 671 i, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags, hFile));683 i, hFile, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags)); 672 684 673 685 if (!SetHandleInformation(hFile, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) … … 697 709 for (i = 0; i < 3; i++) 698 710 { 699 if ( count > i700 && pfdtab->tab[i].fd == 0)711 if ( i < count 712 && pfdtab->tab[i].fd == i) 701 713 hndls[i] = pfdtab->tab[i].native; 702 714 else 703 715 hndls[i] = (intptr_t)INVALID_HANDLE_VALUE; 716 TRACE2((NULL, "shfile_exec_win: i=%d count=%d fd=%d native=%d hndls[%d]=\n", 717 i, count, pfdtab->tab[i].fd, pfdtab->tab[i].native, i, hndls[i])); 704 718 } 705 719
Note:
See TracChangeset
for help on using the changeset viewer.