Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#include <QFile>
#include <QLoggingCategory>

#include <sys/utsname.h>

Check warning on line 16 in deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/utils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <sys/utsname.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <unistd.h>

Check warning on line 17 in deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/utils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <fcntl.h>

Check warning on line 18 in deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/utils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <fcntl.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <errno.h>

Check warning on line 19 in deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/utils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <errno.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

using namespace DDLog;

Expand Down Expand Up @@ -214,9 +215,14 @@
fl.l_pid = getpid(); /* PID */

int fd = open(filepath.toStdString().c_str(), opentype);
//文件打开失败默认为被锁住
//文件打开失败,区分文件不存在与其他错误
if (fd < 0) {
return true;
if (errno == ENOENT) {
//文件不存在,未被锁定
return false;
}
//其他原因无法打开文件,保守起见视为已锁定
return true;
}

if (-1 == fcntl(fd, F_SETLK, &fl)) {
Expand Down
Loading