X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=sidecars%2Flistener%2Frdc.c;h=8edf8c53bd209515f7bdc94546034b8ece9ccf24;hb=6c6ac644fc38772b343347cda37c884af8415cfb;hp=bf7300e08cf48237fcfdb8df7eb91d252f7b4cdd;hpb=fe2bd3618e4748333078f91c26a8a3f5dcf184c4;p=ric-app%2Fmc.git diff --git a/sidecars/listener/rdc.c b/sidecars/listener/rdc.c index bf7300e..8edf8c5 100644 --- a/sidecars/listener/rdc.c +++ b/sidecars/listener/rdc.c @@ -86,7 +86,7 @@ typedef struct { There seems to be an issue with some collectors and thus it is required to initially name the file with a leading dot (.) until the file is closed - and ready to be read by external processes (marking it write only seems + and ready to be read by external processes (marking it write-only seems not to discourage them from trying!). */ static int copy_unlink( char* old, char* new, int mode ) { @@ -104,7 +104,7 @@ static int copy_unlink( char* old, char* new, int mode ) { errno = 0; if( (rfd = open( old, O_RDONLY )) < 0 ) { - logit( LOG_ERR, "copy: open src for copy failed: %s: %s\n", old, strerror( errno ) ); + logit( LOG_ERR, "copy: open src for copy failed: %s: %s", old, strerror( errno ) ); return -1; } @@ -122,7 +122,7 @@ static int copy_unlink( char* old, char* new, int mode ) { //logit( LOG_INFO, "copy: creating file in tmp filename: %s", tfname ); if( (wfd = open( tfname, O_WRONLY | O_CREAT | O_TRUNC, 0200 )) < 0 ) { - logit( LOG_ERR, "copy: open tmp file for copy failed: %s: %s\n", tfname, strerror( errno ) ); + logit( LOG_ERR, "copy: open tmp file for copy failed: %s: %s", tfname, strerror( errno ) ); return -1; } @@ -346,11 +346,12 @@ extern void rdc_set_freq( void* vctx, int freq ) { ctx = (rdc_ctx_t *) vctx; - if( ctx != NULL && freq > 10 ) { + if( ctx != NULL && freq >= 10 ) { ctx->frequency = freq; + logit( LOG_INFO, "(rdc) file roll frequency set to %d seconds", ctx->frequency ); + } else { + logit( LOG_ERR, "(rdc) file roll frequency was not set; ctx was nill or frequency was less than 10s" ); } - - logit( LOG_INFO, "(rdc) file roll frequency set to %d seconds", ctx->frequency ); } /* @@ -471,7 +472,7 @@ int main( ) { ctx = rdc_init( "/tmp/rdc/stage", "/tmp/rdc/final", ".rdc", NULL ); // does not create done files //ctx = rdc_init( "/tmp/rdc/stage", "/tmp/rdc/final", ".rdc", ".done" ); // will create a "done" file if( ctx == NULL ) { - logit( LOG_CRIT, " abort! rdc_init returned a nil pointer\n" ); + logit( LOG_CRIT, " abort! rdc_init returned a nil pointer" ); exit( 1 ); }