2020-10-09 Fred Gleason <fredg@paravelsystems.com>

* Defined a set of standard exit code defines starting with
	'RD_EXIT_' in 'lib/rd.h'.
	* Regularized the exit codes returned by rdlogmanager(1).
	* Cleaned up error handling when using rdlogmanager(1) in
	command line mode.
	* Fixed a bug in rdlogmanager(1) that could leave a log lock
	asserted after exiting when handling schedule import errors.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2020-10-09 13:48:44 -04:00
parent b9f84fca37
commit 998e0124f6
8 changed files with 196 additions and 128 deletions

View File

@@ -615,4 +615,21 @@
*/
#define RD_RSS_XML_FILE_EXTENSION "rss"
/*
* Exit Codes
*/
#define RD_EXIT_OK 0 // Normal exit
#define RD_EXIT_PRIOR_INSTANCE 1 // Prior instance found
#define RD_EXIT_NO_DB 2 // Unable to open database
#define RD_EXIT_SVC_FAILED 3 // Unable to start a service component
#define RD_EXIT_UNKNOWN_OPTION 4 // Unrecognized command line option
#define RD_EXIT_OUTPUT_PROTECTED 5 // Couldn't overwrite output (-P)
#define RD_EXIT_NO_SERVICE 6 // No such service
#define RD_EXIT_NO_LOG 7 // No such log
#define RD_EXIT_NO_REPORT 8 // No such report
#define RD_EXIT_LOG_GEN_FAILED 9 // Log generation failed
#define RD_EXIT_LOG_LINK_FAILED 10 // Schedule import failed
#define RD_EXIT_NO_PERMS 11 // Insufficient permissions
#define RD_EXIT_REPORT_FAILED 12 // Report generation failed
#endif // RD_H

View File

@@ -826,6 +826,8 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
RDLogEvent *dest_event=NULL;
RDLogLine *logline=NULL;
*err_msg="";
RDLogLock *log_lock=new RDLogLock(logname,user,svc_station,this);
if(!TryLock(log_lock,err_msg)) {
delete log_lock;
@@ -877,6 +879,7 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date,
//
if(src==RDSvc::Music) {
if(!ResolveInlineTrafficLinks(logname,err_msg)) {
delete log_lock;
return false;
}
}