Add some error handling for the inotify file system watcher
In the readFromInotify() function, add a check whether the ioctl function is successful or not. In the case of failure, continuing to execute the following code would cause errors in the read function because there is no data in the buffer. Change-Id: Id53037e9e48c97c9eb75835048143875275b6370 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
c2657f9762
commit
cb4f853cb0
@ -366,7 +366,9 @@ void QInotifyFileSystemWatcherEngine::readFromInotify()
|
||||
// qDebug("QInotifyFileSystemWatcherEngine::readFromInotify");
|
||||
|
||||
int buffSize = 0;
|
||||
ioctl(inotifyFd, FIONREAD, (char *) &buffSize);
|
||||
if (ioctl(inotifyFd, FIONREAD, (char *) &buffSize) == -1)
|
||||
return;
|
||||
|
||||
QVarLengthArray<char, 4096> buffer(buffSize);
|
||||
buffSize = read(inotifyFd, buffer.data(), buffSize);
|
||||
char *at = buffer.data();
|
||||
|
Loading…
Reference in New Issue
Block a user