Compare commits

...

3 Commits
1.3.3 ... 1.3.4

3 changed files with 19 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt. # You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
VERSION=1.3.3 VERSION=1.3.4
INCLUDEPATH += plugins INCLUDEPATH += plugins

View File

@@ -14,9 +14,9 @@
#include <QRegExp> #include <QRegExp>
#include <QApplication> #include <QApplication>
//#include <iostream> #if defined (Q_OS_UNIX) || defined (Q_OS_LINUX)
//#include <fstream> #include "unistd.h"
//#include <ctime> #endif
#include "plugins/interfaces.h" #include "plugins/interfaces.h"
@@ -742,6 +742,9 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
QString const &parentName = Utils::getParentName(); QString const &parentName = Utils::getParentName();
Utils::printInfoMsg(
QString("PARENT OF ATB-UPDATE-TOOL (ppid=%1) ").arg(getppid()) + parentName);
if (parentName == "ATBQT" || parentName == "systemd") { if (parentName == "ATBQT" || parentName == "systemd") {
// the tool was not called during 'service' ot during an automatic // the tool was not called during 'service' ot during an automatic
// update procedure. and it was called explicitly with libCAmaster.so // update procedure. and it was called explicitly with libCAmaster.so

View File

@@ -2,7 +2,10 @@
#include "message_handler.h" #include "message_handler.h"
#include "git/git_client.h" #include "git/git_client.h"
#if defined (Q_OS_UNIX) || defined (Q_OS_LINUX)
#include "unistd.h" #include "unistd.h"
#endif
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
@@ -180,18 +183,15 @@ bool Utils::sameFilesInDirs(QDir const &dir1, QDir const &dir2,
QString Utils::getParentName() { // get name of parent process QString Utils::getParentName() { // get name of parent process
QString ppid = QString("/proc/%1/status").arg(getppid()); QString ppid = QString("/proc/%1/status").arg(getppid());
QFile f(ppid); std::ifstream f(ppid.toStdString().c_str());
if (f.exists()) { if (f.is_open()) {
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) { std::string next;
QTextStream in(&f); while (std::getline(f, next)) {
in.setCodec("UTF-8"); QString line = QString(next.c_str()).simplified();
while(!in.atEnd()) { if (line.startsWith("Name")) {
// Name: ATBQT int const idx = line.indexOf(QChar(':'));
QStringList line = in.readLine().split(':'); if (idx != -1) {
if (line.size() == 2) { return line.mid(idx+1).trimmed();
if (line[0].trimmed() == "Name") {
return line[1].trimmed();
}
} }
} }
} }