Diffstat (limited to 'libopie2/opiecore/oprocess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oprocess.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp index 0a361a1..6349c83 100644 --- a/libopie2/opiecore/oprocess.cpp +++ b/libopie2/opiecore/oprocess.cpp | |||
@@ -651,70 +651,70 @@ int OProcess::setupCommunication( Communication comm ) | |||
651 | int OProcess::commSetupDoneP() | 651 | int OProcess::commSetupDoneP() |
652 | { | 652 | { |
653 | int ok = 1; | 653 | int ok = 1; |
654 | 654 | ||
655 | if ( communication != NoCommunication ) | 655 | if ( communication != NoCommunication ) |
656 | { | 656 | { |
657 | if ( communication & Stdin ) | 657 | if ( communication & Stdin ) |
658 | close( in[ 0 ] ); | 658 | close( in[ 0 ] ); |
659 | if ( communication & Stdout ) | 659 | if ( communication & Stdout ) |
660 | close( out[ 1 ] ); | 660 | close( out[ 1 ] ); |
661 | if ( communication & Stderr ) | 661 | if ( communication & Stderr ) |
662 | close( err[ 1 ] ); | 662 | close( err[ 1 ] ); |
663 | 663 | ||
664 | // Don't create socket notifiers and set the sockets non-blocking if | 664 | // Don't create socket notifiers and set the sockets non-blocking if |
665 | // blocking is requested. | 665 | // blocking is requested. |
666 | if ( run_mode == Block ) | 666 | if ( run_mode == Block ) |
667 | return ok; | 667 | return ok; |
668 | 668 | ||
669 | if ( communication & Stdin ) | 669 | if ( communication & Stdin ) |
670 | { | 670 | { |
671 | // ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK)); | 671 | // ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK)); |
672 | innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this ); | 672 | innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this ); |
673 | CHECK_PTR( innot ); | 673 | CHECK_PTR( innot ); |
674 | innot->setEnabled( false ); // will be enabled when data has to be sent | 674 | innot->setEnabled( false ); // will be enabled when data has to be sent |
675 | QObject::connect( innot, SIGNAL( activated( int ) ), | 675 | QObject::connect( innot, SIGNAL( activated(int) ), |
676 | this, SLOT( slotSendData( int ) ) ); | 676 | this, SLOT( slotSendData(int) ) ); |
677 | } | 677 | } |
678 | 678 | ||
679 | if ( communication & Stdout ) | 679 | if ( communication & Stdout ) |
680 | { | 680 | { |
681 | // ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK)); | 681 | // ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK)); |
682 | outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this ); | 682 | outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this ); |
683 | CHECK_PTR( outnot ); | 683 | CHECK_PTR( outnot ); |
684 | QObject::connect( outnot, SIGNAL( activated( int ) ), | 684 | QObject::connect( outnot, SIGNAL( activated(int) ), |
685 | this, SLOT( slotChildOutput( int ) ) ); | 685 | this, SLOT( slotChildOutput(int) ) ); |
686 | if ( communication & NoRead ) | 686 | if ( communication & NoRead ) |
687 | suspend(); | 687 | suspend(); |
688 | } | 688 | } |
689 | 689 | ||
690 | if ( communication & Stderr ) | 690 | if ( communication & Stderr ) |
691 | { | 691 | { |
692 | // ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK)); | 692 | // ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK)); |
693 | errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this ); | 693 | errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this ); |
694 | CHECK_PTR( errnot ); | 694 | CHECK_PTR( errnot ); |
695 | QObject::connect( errnot, SIGNAL( activated( int ) ), | 695 | QObject::connect( errnot, SIGNAL( activated(int) ), |
696 | this, SLOT( slotChildError( int ) ) ); | 696 | this, SLOT( slotChildError(int) ) ); |
697 | } | 697 | } |
698 | } | 698 | } |
699 | return ok; | 699 | return ok; |
700 | } | 700 | } |
701 | 701 | ||
702 | int OProcess::commSetupDoneC() | 702 | int OProcess::commSetupDoneC() |
703 | { | 703 | { |
704 | int ok = 1; | 704 | int ok = 1; |
705 | struct linger so; | 705 | struct linger so; |
706 | memset( &so, 0, sizeof( so ) ); | 706 | memset( &so, 0, sizeof( so ) ); |
707 | 707 | ||
708 | if ( communication & Stdin ) | 708 | if ( communication & Stdin ) |
709 | close( in[ 1 ] ); | 709 | close( in[ 1 ] ); |
710 | if ( communication & Stdout ) | 710 | if ( communication & Stdout ) |
711 | close( out[ 0 ] ); | 711 | close( out[ 0 ] ); |
712 | if ( communication & Stderr ) | 712 | if ( communication & Stderr ) |
713 | close( err[ 0 ] ); | 713 | close( err[ 0 ] ); |
714 | 714 | ||
715 | if ( communication & Stdin ) | 715 | if ( communication & Stdin ) |
716 | ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1; | 716 | ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1; |
717 | else | 717 | else |
718 | { | 718 | { |
719 | int null_fd = open( "/dev/null", O_RDONLY ); | 719 | int null_fd = open( "/dev/null", O_RDONLY ); |
720 | ok &= dup2( null_fd, STDIN_FILENO ) != -1; | 720 | ok &= dup2( null_fd, STDIN_FILENO ) != -1; |