summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oprocess.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/oprocess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oprocess.cpp12
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
@@ -627,118 +627,118 @@ int OProcess::childError( int fdno )
if ( 0 < len )
emit receivedStderr( this, buffer, len );
return len;
}
int OProcess::setupCommunication( Communication comm )
{
int ok;
communication = comm;
ok = 1;
if ( comm & Stdin )
ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, in ) >= 0;
if ( comm & Stdout )
ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, out ) >= 0;
if ( comm & Stderr )
ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, err ) >= 0;
return ok;
}
int OProcess::commSetupDoneP()
{
int ok = 1;
if ( communication != NoCommunication )
{
if ( communication & Stdin )
close( in[ 0 ] );
if ( communication & Stdout )
close( out[ 1 ] );
if ( communication & Stderr )
close( err[ 1 ] );
// Don't create socket notifiers and set the sockets non-blocking if
// blocking is requested.
if ( run_mode == Block )
return ok;
if ( communication & Stdin )
{
// ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK));
innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this );
CHECK_PTR( innot );
innot->setEnabled( false ); // will be enabled when data has to be sent
- QObject::connect( innot, SIGNAL( activated( int ) ),
- this, SLOT( slotSendData( int ) ) );
+ QObject::connect( innot, SIGNAL( activated(int) ),
+ this, SLOT( slotSendData(int) ) );
}
if ( communication & Stdout )
{
// ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK));
outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this );
CHECK_PTR( outnot );
- QObject::connect( outnot, SIGNAL( activated( int ) ),
- this, SLOT( slotChildOutput( int ) ) );
+ QObject::connect( outnot, SIGNAL( activated(int) ),
+ this, SLOT( slotChildOutput(int) ) );
if ( communication & NoRead )
suspend();
}
if ( communication & Stderr )
{
// ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK));
errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this );
CHECK_PTR( errnot );
- QObject::connect( errnot, SIGNAL( activated( int ) ),
- this, SLOT( slotChildError( int ) ) );
+ QObject::connect( errnot, SIGNAL( activated(int) ),
+ this, SLOT( slotChildError(int) ) );
}
}
return ok;
}
int OProcess::commSetupDoneC()
{
int ok = 1;
struct linger so;
memset( &so, 0, sizeof( so ) );
if ( communication & Stdin )
close( in[ 1 ] );
if ( communication & Stdout )
close( out[ 0 ] );
if ( communication & Stderr )
close( err[ 0 ] );
if ( communication & Stdin )
ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1;
else
{
int null_fd = open( "/dev/null", O_RDONLY );
ok &= dup2( null_fd, STDIN_FILENO ) != -1;
close( null_fd );
}
if ( communication & Stdout )
{
ok &= dup2( out[ 1 ], STDOUT_FILENO ) != -1;
ok &= !setsockopt( out[ 1 ], SOL_SOCKET, SO_LINGER, ( char* ) & so, sizeof( so ) );
}
else
{
int null_fd = open( "/dev/null", O_WRONLY );
ok &= dup2( null_fd, STDOUT_FILENO ) != -1;
close( null_fd );
}
if ( communication & Stderr )
{
ok &= dup2( err[ 1 ], STDERR_FILENO ) != -1;
ok &= !setsockopt( err[ 1 ], SOL_SOCKET, SO_LINGER, reinterpret_cast<char *>( &so ), sizeof( so ) );
}
else
{
int null_fd = open( "/dev/null", O_WRONLY );
ok &= dup2( null_fd, STDERR_FILENO ) != -1;
close( null_fd );
}