From 5d948d084872d45cf9fececc012640a95d5e2521 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 25 Feb 2021 12:53:26 -0500 Subject: [PATCH] 2021-02-25 Fred Gleason * Removed vestigal signals from 'RDSocket'. * Fixed a bug in 'RDApplication' that could cause 'openlog(3)' to receive a corrupt 'ident' value. Signed-off-by: Fred Gleason --- ChangeLog | 4 ++++ lib/rdcoreapplication.cpp | 13 +++++++++++-- lib/rdcoreapplication.h | 1 + lib/rdlivewire.cpp | 2 +- lib/rdsocket.cpp | 17 +---------------- lib/rdsocket.h | 9 ++------- ripcd/sasusi.cpp | 2 +- 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c65a7f3..181e68fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21210,3 +21210,7 @@ 2021-02-25 Fred Gleason * Fixed regressions in rdairplay(1) that caused incorrect color rendering. +2021-02-25 Fred Gleason + * Removed vestigal signals from 'RDSocket'. + * Fixed a bug in 'RDApplication' that could cause 'openlog(3)' + to receive a corrupt 'ident' value. diff --git a/lib/rdcoreapplication.cpp b/lib/rdcoreapplication.cpp index 20dded6b..007299ed 100644 --- a/lib/rdcoreapplication.cpp +++ b/lib/rdcoreapplication.cpp @@ -51,6 +51,15 @@ RDCoreApplication::RDCoreApplication(const QString &module_name, app_command_name=cmdname; app_usage=usage; + // + // Maintainer's Note + // + // This for the 'ident' value passed to openlog(1). It *must* + // an actual (const char *) string stored on the heap. *Don't* pass + // a QByteArray! + // + strncpy(app_syslog_name,cmdname.toUtf8(),PATH_MAX-1); + app_heartbeat=NULL; app_airplay_conf=NULL; app_cae=NULL; @@ -155,10 +164,10 @@ bool RDCoreApplication::open(QString *err_msg,RDCoreApplication::ErrorType *err_ // Initialize Logging // if(app_cmd_switch->debugActive()) { - openlog(app_command_name.toUtf8(),LOG_PERROR,app_config->syslogFacility()); + openlog(app_syslog_name,LOG_PERROR,app_config->syslogFacility()); } else { - openlog(app_command_name.toUtf8(),0,app_config->syslogFacility()); + openlog(app_syslog_name,0,app_config->syslogFacility()); } // diff --git a/lib/rdcoreapplication.h b/lib/rdcoreapplication.h index 4ffe8df5..df61740d 100644 --- a/lib/rdcoreapplication.h +++ b/lib/rdcoreapplication.h @@ -101,6 +101,7 @@ class RDCoreApplication : public QObject RDDbHeartbeat *app_heartbeat; QString app_ticket; QString app_module_name; + char app_syslog_name[PATH_MAX]; QString app_command_name; QString app_usage; }; diff --git a/lib/rdlivewire.cpp b/lib/rdlivewire.cpp index b49222ac..99d80433 100644 --- a/lib/rdlivewire.cpp +++ b/lib/rdlivewire.cpp @@ -119,7 +119,7 @@ RDLiveWire::RDLiveWire(unsigned id,QObject *parent) // live_socket=new QTcpSocket(this); connect(live_socket,SIGNAL(connected()),this,SLOT(connectedData())); - connect(live_socket,SIGNAL(connectionClosed()), + connect(live_socket,SIGNAL(disconnected()), this,SLOT(connectionClosedData())); connect(live_socket,SIGNAL(readyRead()),this,SLOT(readyReadData())); connect(live_socket,SIGNAL(error(QAbstractSocket::SocketError)), diff --git a/lib/rdsocket.cpp b/lib/rdsocket.cpp index 79cb532d..37a4372c 100644 --- a/lib/rdsocket.cpp +++ b/lib/rdsocket.cpp @@ -2,7 +2,7 @@ // // A QTcpSocket object with connection-ID. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -31,10 +31,7 @@ RDSocket::RDSocket(int id,QObject *parent) connect(this,SIGNAL(hostFound()),this,SLOT(hostFoundData())); connect(this,SIGNAL(connected()),this,SLOT(connectedData())); connect(this,SIGNAL(disconnected()),this,SLOT(connectionClosedData())); - connect(this,SIGNAL(delayedCloseFinished()), - this,SLOT(delayedCloseFinishedData())); connect(this,SIGNAL(readyRead()),this,SLOT(readyReadData())); - connect(this,SIGNAL(bytesWritten(int)),this,SLOT(bytesWrittenData(int))); connect(this,SIGNAL(error(QAbstractSocket::SocketError)), this,SLOT(errorData(QAbstractSocket::SocketError))); } @@ -58,24 +55,12 @@ void RDSocket::connectionClosedData() } -void RDSocket::delayedCloseFinishedData() -{ - emit delayedCloseFinishedID(id_num); -} - - void RDSocket::readyReadData() { emit readyReadID(id_num); } -void RDSocket::bytesWrittenData(int nbytes) -{ - emit bytesWrittenID(nbytes,id_num); -} - - void RDSocket::errorData(QAbstractSocket::SocketError error) { emit errorID(error,id_num); diff --git a/lib/rdsocket.h b/lib/rdsocket.h index d1c45f71..21cac5cc 100644 --- a/lib/rdsocket.h +++ b/lib/rdsocket.h @@ -2,7 +2,7 @@ // // A QSocket object with connection-ID. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -21,8 +21,7 @@ #ifndef RDSOCKET_H #define RDSOCKET_H -#include -#include +#include class RDSocket : public QTcpSocket { @@ -34,18 +33,14 @@ class RDSocket : public QTcpSocket void hostFoundID(int id); void connectedID(int id); void connectionClosedID(int id); - void delayedCloseFinishedID(int id); void readyReadID(int id); - void bytesWrittenID(int nbytes,int id); void errorID(QAbstractSocket::SocketError error,int id); private slots: void hostFoundData(); void connectedData(); void connectionClosedData(); - void delayedCloseFinishedData(); void readyReadData(); - void bytesWrittenData(int nbytes); void errorData(QAbstractSocket::SocketError error); private: diff --git a/ripcd/sasusi.cpp b/ripcd/sasusi.cpp index 14403b41..3e827ca5 100644 --- a/ripcd/sasusi.cpp +++ b/ripcd/sasusi.cpp @@ -96,7 +96,7 @@ SasUsi::SasUsi(RDMatrix *matrix,QObject *parent) connect(sas_socket,SIGNAL(readyRead()), this,SLOT(readyReadData())); connect(sas_socket,SIGNAL(error(QAbstractSocket::SocketError)), - this,SLOT(errorData(Q))); + this,SLOT(errorData(QAbstractSocket::SocketError))); ipConnect(); break;