qlockfile_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qlockfile_unix.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6static QByteArray localHostName()-
7{-
8 QByteArray hostName(512, Qt::Uninitialized);-
9 if (gethostname(hostName.data(), hostName.size()) == -1
gethostname(ho....size()) == -1Description
TRUEnever evaluated
FALSEevaluated 608 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-608
10 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
11 hostName.truncate(strlen(hostName.data()));-
12 return
executed 608 times by 8 tests: return hostName;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
hostName;
executed 608 times by 8 tests: return hostName;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
608
13}-
14-
15-
16static qint64 qt_write_loop(int fd, const char *data, qint64 len)-
17{-
18 qint64 pos = 0;-
19 while (pos < len
pos < lenDescription
TRUEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
578
20 const qint64 ret = qt_safe_write(fd, data + pos, len - pos);-
21 if (ret == -1
ret == -1Description
TRUEnever evaluated
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-578
22 return
never executed: return pos;
pos;
never executed: return pos;
0
23 pos += ret;-
24 }
executed 578 times by 8 tests: end of block
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
578
25 return
executed 578 times by 8 tests: return pos;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
pos;
executed 578 times by 8 tests: return pos;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
578
26}-
27-
28int QLockFilePrivate::checkFcntlWorksAfterFlock(const QString &fn)-
29{-
30-
31 QTemporaryFile file(fn);-
32 if (!file.open()
!file.open()Description
TRUEnever evaluated
FALSEevaluated 23 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-23
33 return
never executed: return 0;
0;
never executed: return 0;
0
34 const int fd = file.d_func()->engine()->handle();-
35-
36 if (flock(fd, 2 | 4) == -1
flock(fd, 2 | 4) == -1Description
TRUEnever evaluated
FALSEevaluated 23 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-23
37 return
never executed: return 0;
0;
never executed: return 0;
0
38-
39 struct flock flockData;-
40 flockData.l_type = 1;-
41 flockData.l_whence = 0;-
42 flockData.l_start = 0;-
43 flockData.l_len = 0;-
44 flockData.l_pid = getpid();-
45 if (fcntl(fd, 6, &flockData) == -1
fcntl(fd, 6, &flockData) == -1Description
TRUEnever evaluated
FALSEevaluated 23 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-23
46 return
never executed: return 0;
0;
never executed: return 0;
0
47 return
executed 23 times by 8 tests: return 1;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
1;
executed 23 times by 8 tests: return 1;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
23
48-
49-
50-
51}-
52-
53-
54-
55-
56-
57-
58-
59typedef QCache<QString, bool> CacheType;-
60namespace { namespace Q_QGS_fcntlOK { typedef CacheType Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 7 times by 7 tests
Evaluated by:
  • tst_languagechange - unknown status
  • tst_qcolordialog - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlockfile - unknown status
  • tst_qsettings - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 7 times by 7 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_languagechange - unknown status
  • tst_qcolordialog - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlockfile - unknown status
  • tst_qsettings - unknown status
}
executed 7 times by 7 tests: end of block
Executed by:
  • tst_languagechange - unknown status
  • tst_qcolordialog - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlockfile - unknown status
  • tst_qsettings - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (10))) : value (10) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 600 times by 7 tests: return &holder.value;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
&holder.value;
executed 600 times by 7 tests: return &holder.value;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
} } } static QGlobalStatic<CacheType, Q_QGS_fcntlOK::innerFunction, Q_QGS_fcntlOK::guard> fcntlOK;;
0-600
61static QBasicMutex fcntlLock;-
62-
63-
64-
65-
66-
67-
68static bool fcntlWorksAfterFlock(const QString &fn)-
69{-
70 QMutexLocker lock(&fcntlLock);-
71 if (fcntlOK.isDestroyed()
fcntlOK.isDestroyed()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlockfile - unknown status
FALSEevaluated 578 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
)
1-578
72 return
executed 1 time by 1 test: return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
Executed by:
  • tst_qlockfile - unknown status
QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
executed 1 time by 1 test: return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
Executed by:
  • tst_qlockfile - unknown status
1
73 bool *worksPtr = fcntlOK->object(fn);-
74 if (worksPtr
worksPtrDescription
TRUEevaluated 556 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
FALSEevaluated 22 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
)
22-556
75 return
executed 556 times by 7 tests: return *worksPtr;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
*worksPtr;
executed 556 times by 7 tests: return *worksPtr;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
556
76-
77 const bool val = QLockFilePrivate::checkFcntlWorksAfterFlock(fn);-
78 worksPtr = new bool(val);-
79 fcntlOK->insert(fn, worksPtr);-
80-
81 return
executed 22 times by 7 tests: return val;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
val;
executed 22 times by 7 tests: return val;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
22
82}-
83-
84static bool setNativeLocks(const QString &fileName, int fd)-
85{-
86-
87 if (flock(fd, 2 | 4) == -1
flock(fd, 2 | 4) == -1Description
TRUEnever evaluated
FALSEevaluated 579 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-579
88 return
never executed: return false;
false;
never executed: return false;
0
89-
90 struct flock flockData;-
91 flockData.l_type = 1;-
92 flockData.l_whence = 0;-
93 flockData.l_start = 0;-
94 flockData.l_len = 0;-
95 flockData.l_pid = getpid();-
96 if (fcntlWorksAfterFlock(QDir::cleanPath(QFileInfo(fileName).absolutePath()) + QString('/'))
fcntlWorksAfte... QString('/'))Description
TRUEevaluated 579 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
FALSEnever evaluated
0-579
97 && fcntl(fd, 6, &flockData) == -1
fcntl(fd, 6, &flockData) == -1Description
TRUEnever evaluated
FALSEevaluated 579 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-579
98 return
never executed: return false;
false;
never executed: return false;
0
99 }-
100 return
executed 579 times by 8 tests: return true;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
true;
executed 579 times by 8 tests: return true;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
579
101}-
102-
103QLockFile::LockError QLockFilePrivate::tryLock_sys()-
104{-
105-
106-
107-
108 QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'-
109 % QCoreApplication::applicationName().toUtf8() % '\n'-
110 % localHostName() % '\n';-
111-
112 const QByteArray lockFileName = QFile::encodeName(fileName);-
113 const int fd = qt_safe_open(lockFileName.constData(), 01 | 0100 | 0200, 0666);-
114 if (fd < 0
fd < 0Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
18-578
115 switch ((*__errno_location ())) {-
116 case
executed 17 times by 1 test: case 17:
Executed by:
  • tst_QLockFile
17:
executed 17 times by 1 test: case 17:
Executed by:
  • tst_QLockFile
17
117 return
executed 17 times by 1 test: return QLockFile::LockFailedError;
Executed by:
  • tst_QLockFile
QLockFile::LockFailedError;
executed 17 times by 1 test: return QLockFile::LockFailedError;
Executed by:
  • tst_QLockFile
17
118 case
executed 1 time by 1 test: case 13:
Executed by:
  • tst_QLockFile
13:
executed 1 time by 1 test: case 13:
Executed by:
  • tst_QLockFile
1
119 case
never executed: case 30:
30:
never executed: case 30:
0
120 return
executed 1 time by 1 test: return QLockFile::PermissionError;
Executed by:
  • tst_QLockFile
QLockFile::PermissionError;
executed 1 time by 1 test: return QLockFile::PermissionError;
Executed by:
  • tst_QLockFile
1
121 default
never executed: default:
:
never executed: default:
0
122 return
never executed: return QLockFile::UnknownError;
QLockFile::UnknownError;
never executed: return QLockFile::UnknownError;
0
123 }-
124 }-
125-
126 if (!setNativeLocks(fileName, fd)
!setNativeLocks(fileName, fd)Description
TRUEnever evaluated
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-578
127 const int errnoSaved = (*__errno_location ());-
128 QMessageLogger(__FILE__, 194, __PRETTY_FUNCTION__).warning() << "setNativeLocks failed:" << qt_error_string(errnoSaved);-
129 }
never executed: end of block
0
130-
131 if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()
qt_write_loop(...ileData.size()Description
TRUEnever evaluated
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-578
132 close(fd);-
133 if (!QFile::remove(fileName)
!QFile::remove(fileName)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
134 QMessageLogger(__FILE__, 200, __PRETTY_FUNCTION__).warning("QLockFile: Could not remove our own lock file %s.", QString(fileName).toLocal8Bit().constData());
never executed: QMessageLogger(__FILE__, 200, __PRETTY_FUNCTION__).warning("QLockFile: Could not remove our own lock file %s.", QString(fileName).toLocal8Bit().constData());
0
135 return
never executed: return QLockFile::UnknownError;
QLockFile::UnknownError;
never executed: return QLockFile::UnknownError;
0
136 }-
137-
138-
139 fileHandle = fd;-
140-
141-
142-
143 fdatasync(fileHandle);-
144-
145-
146-
147-
148 return
executed 578 times by 8 tests: return QLockFile::NoError;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
QLockFile::NoError;
executed 578 times by 8 tests: return QLockFile::NoError;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
578
149}-
150-
151bool QLockFilePrivate::removeStaleLock()-
152{-
153 const QByteArray lockFileName = QFile::encodeName(fileName);-
154 const int fd = qt_safe_open(lockFileName.constData(), 01, 0666);-
155 if (fd < 0
fd < 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
)
0-1
156 return
never executed: return false;
false;
never executed: return false;
0
157 bool success = setNativeLocks(fileName, fd)
setNativeLocks(fileName, fd)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
&& (::
(::unlink(lockFileName) == 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
unlink(lockFileName) == 0)
(::unlink(lockFileName) == 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
;
0-1
158 close(fd);-
159 return
executed 1 time by 1 test: return success;
Executed by:
  • tst_QLockFile
success;
executed 1 time by 1 test: return success;
Executed by:
  • tst_QLockFile
1
160}-
161-
162bool QLockFilePrivate::isApparentlyStale() const-
163{-
164 qint64 pid;-
165 QString hostname, appname;-
166 if (getLockInfo(&pid, &hostname, &appname)
getLockInfo(&p...ame, &appname)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QLockFile
) {
2-12
167 if (hostname.isEmpty()
hostname.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
|| hostname == QString::fromLocal8Bit(localHostName())
hostname == QS...calHostName())Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
) {
0-12
168 if (::
::kill(pid, 0) == -1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
kill(pid, 0) == -1
::kill(pid, 0) == -1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
&& (*
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ()) == 3
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0-12
169 return
never executed: return true;
true;
never executed: return true;
0
170 const QString processName = processNameByPid(pid);-
171 if (!processName.isEmpty()
!processName.isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
) {
0-12
172 QFileInfo fi(appname);-
173 if (fi.isSymLink()
fi.isSymLink()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
)
0-12
174 fi.setFile(fi.symLinkTarget());
never executed: fi.setFile(fi.symLinkTarget());
0
175 if (processName != fi.fileName()
processName != fi.fileName()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
)
0-12
176 return
never executed: return true;
true;
never executed: return true;
0
177 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QLockFile
12
178 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QLockFile
12
179 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QLockFile
12
180 const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());-
181 return
executed 14 times by 1 test: return staleLockTime > 0 && age > staleLockTime;
Executed by:
  • tst_QLockFile
staleLockTime > 0
staleLockTime > 0Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
&& age > staleLockTime
age > staleLockTimeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
;
executed 14 times by 1 test: return staleLockTime > 0 && age > staleLockTime;
Executed by:
  • tst_QLockFile
0-14
182}-
183-
184QString QLockFilePrivate::processNameByPid(qint64 pid)-
185{-
186-
187-
188-
189-
190-
191 if (!QFile::exists(([]() -> QString { enum { Size = sizeof(u"" "/proc/version")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/proc/version" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 12 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QLockFile
qstring_literal_temp;
executed 12 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QLockFile
}()))
!QFile::exists...al_temp; }()))Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
)
0-12
192 return
never executed: return QString();
QString();
never executed: return QString();
0
193 char exePath[64];-
194 char buf[4096 + 1];-
195 sprintf(exePath, "/proc/%lld/exe", pid);-
196 size_t len = (size_t)readlink(exePath, buf, sizeof(buf));-
197 if (len >= sizeof(buf)
len >= sizeof(buf)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
) {
0-12
198-
199 return
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "/ERROR/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/ERROR/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
([]() -> QString { enum { Size = sizeof(u"" "/ERROR/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/ERROR/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}());
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "/ERROR/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/ERROR/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
0
200 }-
201 buf[len] = 0;-
202 return
executed 12 times by 1 test: return QFileInfo(QFile::decodeName(buf)).fileName();
Executed by:
  • tst_QLockFile
QFileInfo(QFile::decodeName(buf)).fileName();
executed 12 times by 1 test: return QFileInfo(QFile::decodeName(buf)).fileName();
Executed by:
  • tst_QLockFile
12
203}-
204-
205void QLockFile::unlock()-
206{-
207 QLockFilePrivate * const d = d_func();-
208 if (!d->isLocked
!d->isLockedDescription
TRUEevaluated 3626 times by 31 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QLockFile
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSettings
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • ...
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
578-3626
209 return;
executed 3626 times by 31 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QLockFile
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSettings
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • ...
3626
210 close(d->fileHandle);-
211 d->fileHandle = -1;-
212 if (!QFile::remove(d->fileName)
!QFile::remove(d->fileName)Description
TRUEnever evaluated
FALSEevaluated 578 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-578
213 QMessageLogger(__FILE__, 311, __PRETTY_FUNCTION__).warning() << "Could not remove our own lock file" << d->fileName << "maybe permissions changed meanwhile?";-
214-
215 }
never executed: end of block
0
216 d->lockError = QLockFile::NoError;-
217 d->isLocked = false;-
218}
executed 578 times by 8 tests: end of block
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
578
219-
220-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9