diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-29 11:16:04 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-08-17 04:45:29 +0000 |
commit | 0dee566e98f5ff4f224e596de1c04de4f9685df4 (patch) | |
tree | b6373e01f79eb135b3c01593c453cc002cfd0e10 /src/corelib/io/qfilesystementry_p.h | |
parent | 9a50333dd03969abb3f09c0f90dcb4afd048e47a (diff) |
QFileSystemEngine: verify that the file name isn't empty
Making system calls with empty file names is not a good idea. When you
run qmake $srcdir, you see this in strace:
stat("", 0x7ffed229e250) = -1 ENOENT (No such file or directory)
(twice)
I've also inlined the isEmpty() function for better code generation.
Some functions take QSystemError and some don't. That needs to be
corrected at some point, possibly with something like std::expected.
Change-Id: I1eba2b016de74620bfc8fffd14ccbfa162f93631
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/io/qfilesystementry_p.h')
-rw-r--r-- | src/corelib/io/qfilesystementry_p.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h index 700696d09e..251eca553a 100644 --- a/src/corelib/io/qfilesystementry_p.h +++ b/src/corelib/io/qfilesystementry_p.h @@ -98,7 +98,10 @@ public: #endif bool isRoot() const; - bool isEmpty() const; + bool isEmpty() const + { + return m_filePath.isEmpty() && m_nativeFilePath.isEmpty(); + } void clear() { *this = QFileSystemEntry(); |