summaryrefslogtreecommitdiffstats
path: root/kioslave/sftp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-23 02:41:47 -0500
committerSlávek Banko <slavek.banko@axis.cz>2012-06-03 03:27:09 +0200
commit4a67f231f00d75b9b91e13874d70d5e9fcf9c460 (patch)
treed90df320aa715dde9b860e463f8b9e91b4c0685d /kioslave/sftp
parentc47b417bbb791b9bd4156000c9a3ecde7babcbbe (diff)
downloadtdebase-4a67f231f00d75b9b91e13874d70d5e9fcf9c460.tar.gz
tdebase-4a67f231f00d75b9b91e13874d70d5e9fcf9c460.zip
Fix sftp failure on newer systems
This closes Bug 897 (cherry picked from commit e72f4926c094b2bd94501518fbcd2a3e66a74f6a)
Diffstat (limited to 'kioslave/sftp')
-rw-r--r--kioslave/sftp/ksshprocess.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/kioslave/sftp/ksshprocess.cpp b/kioslave/sftp/ksshprocess.cpp
index 9b2323bd6..d558dd737 100644
--- a/kioslave/sftp/ksshprocess.cpp
+++ b/kioslave/sftp/ksshprocess.cpp
@@ -569,7 +569,9 @@ TQString KSshProcess::getLine() {
// If we still don't have anything in our buffer so there must
// not be anything on the pty or stderr. Setup a select()
// to wait for some data from SSH.
- if( buffer.empty() ) {
+ // Hack around select() failure on newer systems
+ unsigned long milliseconds = 0;
+ while ((buffer.size() == 0) && (milliseconds < (60*1000))) {
//kdDebug(KSSHPROC) << "KSshProcess::getLine(): " <<
// "Line buffer empty, calling select() to wait for data." << endl;
int errfd = ssh.stderrFd();
@@ -616,14 +618,18 @@ TQString KSshProcess::getLine() {
// had data on it first.
if( FD_ISSET(ptyfd, &rfds) ) {
ptyLine = ssh.readLineFromPty(false);
- buffer.prepend(TQString(ptyLine));
+ if (ptyLine.size() > 0) {
+ buffer.prepend(TQString(ptyLine));
+ }
//kdDebug(KSSHPROC) << "KSshProcess::getLine(): "
// "line from pty -" << ptyLine << endl;
}
-
+
if( FD_ISSET(errfd, &rfds) ) {
errLine = ssh.readLineFromStderr(false);
- buffer.prepend(TQString(errLine));
+ if (errLine.size() > 0) {
+ buffer.prepend(TQString(errLine));
+ }
//kdDebug(KSSHPROC) << "KSshProcess::getLine(): "
// "line from err -" << errLine << endl;
}
@@ -637,7 +643,11 @@ TQString KSshProcess::getLine() {
kdDebug(KSSHPROC) << "KSshProcess::getLine(): "
"Exception on std err file descriptor." << endl;
}
-
+
+ if (buffer.size() == 0) {
+ milliseconds++;
+ usleep(1000);
+ }
}
}