summaryrefslogtreecommitdiff
path: root/qmake/tools/qfile_unix.cpp
Side-by-side diff
Diffstat (limited to 'qmake/tools/qfile_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/tools/qfile_unix.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/qmake/tools/qfile_unix.cpp b/qmake/tools/qfile_unix.cpp
index 2d5a856..460bf06 100644
--- a/qmake/tools/qfile_unix.cpp
+++ b/qmake/tools/qfile_unix.cpp
@@ -437,7 +437,10 @@ QIODevice::Offset QFile::size() const
struct stat st;
+ int ret = 0;
if ( isOpen() ) {
- ::fstat( fh ? fileno(fh) : fd, &st );
+ ret = ::fstat( fh ? fileno(fh) : fd, &st );
} else {
- ::stat( QFile::encodeName(fn), &st );
+ ret = ::stat( QFile::encodeName(fn), &st );
}
+ if ( ret == -1 )
+ return 0;
#if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET)
@@ -540,3 +543,3 @@ Q_LONG QFile::readBlock( char *p, Q_ULONG len )
while( nread < l ) {
- *p = ungetchBuffer[ l - nread - 1 ];
+ *p = ungetchBuffer.at( l - nread - 1 );
p++;
@@ -631,3 +634,5 @@ Q_LONG QFile::writeBlock( const char *p, Q_ULONG len )
This is a small positive integer, suitable for use with C library
- functions such as fdopen() and fcntl(), as well as with QSocketNotifier.
+ functions such as fdopen() and fcntl(). On systems that use file
+ descriptors for sockets (ie. Unix systems, but not Windows) the handle
+ can be used with QSocketNotifier as well.