fix error handling (errno checking)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 17 Mar 2006 13:45:08 +0000 (13:45 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 17 Mar 2006 13:45:08 +0000 (13:45 +0000)
lib/base/filepush.cpp

index 0f41b39..4bc5205 100644 (file)
@@ -54,15 +54,14 @@ void eFilePushThread::thread()
 //                     eDebug("wrote %d bytes", w);
                        if (w <= 0)
                        {
 //                     eDebug("wrote %d bytes", w);
                        if (w <= 0)
                        {
-                               if (errno == -EINTR)
+                               if (errno == EINTR)
                                        continue;
                                break;
                                // ... we would stop the thread
                        }
 
                                        continue;
                                break;
                                // ... we would stop the thread
                        }
 
-                               /* this should flush all written pages to disk. */
                        posix_fadvise(m_fd_dest, dest_pos, w, POSIX_FADV_DONTNEED);
                        posix_fadvise(m_fd_dest, dest_pos, w, POSIX_FADV_DONTNEED);
-                       
+
                        dest_pos += w;
                        written_since_last_sync += w;
                        
                        dest_pos += w;
                        written_since_last_sync += w;
                        
@@ -119,7 +118,7 @@ void eFilePushThread::thread()
                        {
                                eDebug("sending PVR commit");
                                already_empty = 1;
                        {
                                eDebug("sending PVR commit");
                                already_empty = 1;
-                               if (::ioctl(m_fd_dest, PVR_COMMIT) == EINTR)
+                               if (::ioctl(m_fd_dest, PVR_COMMIT) < 0 && errno == EINTR)
                                        continue;
                                eDebug("commit done");
                                                /* well check again */
                                        continue;
                                eDebug("commit done");
                                                /* well check again */