diff --git a/ChangeLog b/ChangeLog index 02c5dd02..05ac8bc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21760,3 +21760,5 @@ * Cleaned up compile warning in 'lib/rdcae.cpp'. 2021-06-01 Fred Gleason * Cleaned up compile warning in 'lib/rdcart_dialog.cpp'. +2021-06-01 Fred Gleason + * Added 'RDCheckExitCode()' functions in 'lib/rdconf.[cpp|h]. diff --git a/lib/rdcart_dialog.cpp b/lib/rdcart_dialog.cpp index dbc21f73..4d588a25 100644 --- a/lib/rdcart_dialog.cpp +++ b/lib/rdcart_dialog.cpp @@ -310,12 +310,8 @@ void RDCartDialog::editorData() delete q; if(fork()==0) { - int exit_code=system((cmd+" &").toUtf8()); - if(exit_code!=0) { - rda->syslog(LOG_WARNING, - "editor subprocess returned non-zero exit code %d [%s]", - exit_code,strerror(errno)); - } + RDCheckExitCode("RDCartDialog editor subprocess", + system((cmd+" &").toUtf8())); exit(0); } } diff --git a/lib/rdconf.cpp b/lib/rdconf.cpp index b6df3ebe..08cbc71a 100644 --- a/lib/rdconf.cpp +++ b/lib/rdconf.cpp @@ -31,6 +31,8 @@ #include +#include + #define RDCONF_FILE_SEPARATOR '/' #include "rddb.h" @@ -1185,3 +1187,22 @@ QList RDGetPids(const QString &program) return pids; } + + +int RDCheckExitCode(const QString &msg,int exit_code) +{ + if(exit_code!=0) { + rda->syslog(LOG_WARNING,"%s returned non-zero exit code %d [%s]", + msg.toUtf8().constData(),exit_code,strerror(errno)); + } +} + + +int RDCheckExitCode(RDConfig *config,const QString &msg,int exit_code) +{ + if(exit_code!=0) { + RDApplication::syslog(config,LOG_WARNING, + "%s returned non-zero exit code %d [%s]", + msg.toUtf8().constData(),exit_code,strerror(errno)); + } +} diff --git a/lib/rdconf.h b/lib/rdconf.h index 50bc8430..419ea337 100644 --- a/lib/rdconf.h +++ b/lib/rdconf.h @@ -36,6 +36,8 @@ #include #include +#include + /* Function Prototypes */ int GetPrivateProfileBool(const char *,const char *,const char *,bool); int GetPrivateProfileString(const char *,const char *,const char *,char *, @@ -110,5 +112,8 @@ bool RDModulesActive(); QByteArray RDStringToData(const QString &str); QString RDStringToHex(const QString &str); QList RDGetPids(const QString &program); +int RDCheckExitCode(const QString &msg,int exit_code); +int RDCheckExitCode(RDConfig *config,const QString &msg,int exit_code); + #endif // RDCONF_H