summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/filetransfer.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/filetransfer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 14787f6..8ca0df2 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -14,12 +14,13 @@
FileTransfer::FileTransfer( Type t, IOLayer* lay )
: FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) {
signal(SIGPIPE, SIG_IGN );
+ m_pid = 0;
m_not = 0l;
m_proc = 0l;
}
FileTransfer::~FileTransfer() {
}
@@ -45,12 +46,13 @@ void FileTransfer::sendFile( const QString& file ) {
m_pid = fork();
switch( m_pid ) {
case -1:
emit error( StartError, tr("Was not able to fork") );
+ slotExec();
break;
case 0:{
setupChild();
qWarning("output:"+file );
/* exec */
char* verbose = "-vv";
@@ -174,13 +176,12 @@ void FileTransfer::slotRead() {
QStringList lis = QStringList::split(' ', str );
/*
* Transfer finished.. either complete or incomplete
*/
if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
qWarning("sent!!!!");
- emit sent();
return;
}
/*
* do progress reading
*/
slotProgress( lis );
@@ -233,21 +234,23 @@ void FileTransfer::slotProgress( const QStringList& list ) {
emit progress(m_file, m_prog, bps, -1, min , sec );
}
}
void FileTransfer::cancel() {
if(m_pid > 0) ::kill(m_pid,9 );
- delete m_not;
+
}
void FileTransfer::slotExec() {
qWarning("exited!");
char buf[2];
::read(m_term[0], buf, 1 );
delete m_proc;
delete m_not;
m_proc = m_not = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
close( m_comm[1] );
+ layer()->closeRawIO( m_fd );
emit sent();
+ m_pid = 0;
}