[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdepim/enterprise4/kdepimlibs/qgpgme
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-09-02 13:53:36
Message-ID: 20100902135336.34574AC881 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1171020 by mutz:

QGpgME::QIODeviceDataProvider: in read(), don't convert -1 (error) to 0 (EOF), just \
make sure that errno is set

Neither me, nor the author of the workaround remember in what case
QProcess was returning -1 when it should have returned 0. In addition,
this workaround breaks error detection when there actually _is_ an
error (test: set pack-command=tar cf - -T- --nu (instead of --null)
in libkleopatrarc).

MERGE: delay for one month, let's see what breaks first

 M  +7 -0      dataprovider.cpp  


--- branches/kdepim/enterprise4/kdepimlibs/qgpgme/dataprovider.cpp #1171019:1171020
@@ -183,6 +183,8 @@
       ? blocking_read( mIO, static_cast<char*>(buffer), bufSize )
       : mIO->read( static_cast<char*>(buffer), bufSize ) ;
 
+  // (marc): I had to disable this for QProcess' error reporting to work correctly
+#if 0
   //workaround: some QIODevices (known example: QProcess) might not return 0 (EOF), \
but immediately -1 when finished. If no  //errno is set, gpgme doesn't detect the \
error and loops forever. So return 0 on the very first -1 in case errno is 0  
@@ -196,6 +198,11 @@
   if ( numRead < 0 )
       mErrorOccurred = true;
   return rc;
+#endif
+  // Returning -1 while not setting errno makes gpgme loop forever. So make sure \
errno is set: +  if ( numRead < 0 && errno == 0 )
+      errno = EIO;
+  return numRead;
 }
 
 ssize_t QIODeviceDataProvider::write( const void * buffer, size_t bufSize ) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic