2021-06-01 Fred Gleason <fredg@paravelsystems.com>

* Cleaned up compile warnings in 'lib/rdinstancelock.cpp'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-06-01 12:07:14 -04:00
parent 88572c4c08
commit fb24010a29
3 changed files with 21 additions and 14 deletions

View File

@@ -21776,3 +21776,5 @@
* Cleaned up a compile warning in 'lib/rdevent_line.cpp'. * Cleaned up a compile warning in 'lib/rdevent_line.cpp'.
2021-06-01 Fred Gleason <fredg@paravelsystems.com> 2021-06-01 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up compile warnings in 'lib/rdformpost.cpp'. * Cleaned up compile warnings in 'lib/rdformpost.cpp'.
2021-06-01 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up compile warnings in 'lib/rdinstancelock.cpp'.

View File

@@ -2,7 +2,7 @@
// //
// An abstract instance-locking class. // An abstract instance-locking class.
// //
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License // it under the terms of the GNU Library General Public License
@@ -26,9 +26,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <qstring.h> #include <QDir>
#include <qdir.h> #include <QString>
#include <rdapplication.h>
#include <rdinstancelock.h> #include <rdinstancelock.h>
RDInstanceLock::RDInstanceLock(QString path) RDInstanceLock::RDInstanceLock(QString path)
@@ -58,7 +59,11 @@ bool RDInstanceLock::lock()
lock_locked=false; lock_locked=false;
return false; return false;
} }
fscanf(file,"%d",&pid); if(fscanf(file,"%d",&pid)!=1) {
rda->syslog(LOG_WARNING,
"RDInstanceLock::lock fscanf returned a parser failure [%s]",
strerror(errno));
}
fclose(file); fclose(file);
dir.setPath(QString().sprintf("/proc/%u",pid)); dir.setPath(QString().sprintf("/proc/%u",pid));
if(!dir.exists()) { if(!dir.exists()) {

View File

@@ -53,16 +53,6 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
air_panel=NULL; air_panel=NULL;
//
// Ensure Single Instance
//
air_lock=new RDInstanceLock(RDHomeDir()+"/.rdairplaylock");
if(!air_lock->lock()) {
QMessageBox::information(this,tr("RDAirPlay"),
tr("Multiple instances not allowed!"));
exit(1);
}
// //
// Get the Startup Date/Time // Get the Startup Date/Time
// //
@@ -77,6 +67,16 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
exit(1); exit(1);
} }
//
// Ensure Single Instance
//
air_lock=new RDInstanceLock(RDHomeDir()+"/.rdairplaylock");
if(!air_lock->lock()) {
QMessageBox::information(this,tr("RDAirPlay"),
tr("Multiple instances not allowed!"));
exit(1);
}
// //
// Read Command Options // Read Command Options
// //