[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [RHEL6-BRANCH] Redirect uncpio errors to syslog (#588671)



On 05/11/2010 11:40 PM, Brian C. Lane wrote:
This assumes that openlog has already been called.

These functions are curently only used by loader, which calls openlog
before calling the uncpio functions.

Resolves: rhbz#588671
---
  isys/uncpio.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/isys/uncpio.c b/isys/uncpio.c
index 171eb6b..c65ad0f 100644
--- a/isys/uncpio.c
+++ b/isys/uncpio.c
@@ -36,6 +36,7 @@
  #include<sys/stat.h>
  #include<unistd.h>
  #include<utime.h>
+#include<syslog.h>

  #include "cpio.h"
  #include "stubs.h"
@@ -504,7 +505,7 @@ int myCpioInstallArchive(gzFile stream, struct cpioFileMapping * mappings,

      do {
  	if ((rc = getNextHeader(&fd,&ch, NULL))) {
-	    fprintf(stderr, _("error %d reading header: %s\n"), rc,
+	    syslog( LOG_WARNING, _("error %d reading header: %s\n"), rc,
  		    myCpioStrerror(rc));
  	    return CPIOERR_BAD_HEADER;
  	}
@@ -755,7 +756,7 @@ int myCpioFilterArchive(gzFile inStream, gzFile outStream, char ** patterns) {

      do {
  	if ((rc = getNextHeader(&inFd,&ch,&pHeader))) {
-	    fprintf(stderr, _("error %d reading header: %s\n"), rc,
+	    syslog( LOG_WARNING, _("error %d reading header: %s\n"), rc,
  		    myCpioStrerror(rc));
  	    return CPIOERR_BAD_HEADER;
  	}

Ack for rhel6.

For teh rawhide I think you should use the logging facilities in isys/log.h. The method that initializes the log there is 'openLog' (note the upper case), but your argument that the logging was initialized beforehand should still hold.

Ales







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]