diff options
author | Kevin Coffman <kwc@citi.umich.edu> | 2007-10-12 16:35:20 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-10-15 09:50:56 +1000 |
commit | 58ddd1faed90c83abad80ab7f460976cc0c0a213 (patch) | |
tree | 158df9556bc9c0ad4ab5271f8131ab30cff1640e /utils/gssd/err_util.c | |
parent | f0a6165a611c28e94513b1c2df5826b23d154ba4 (diff) | |
download | nfs-utils-58ddd1faed90c83abad80ab7f460976cc0c0a213.tar.gz nfs-utils-58ddd1faed90c83abad80ab7f460976cc0c0a213.tar.xz nfs-utils-58ddd1faed90c83abad80ab7f460976cc0c0a213.zip |
Remove old logging implementation for idmapd and rework gssd and idmapd to use the new xlog logging infrastructure.
This patch removes all of the old idmap_* logging functions and replaced them
with the corresponding xlog functions. In addition that that it also reworks
the gssd logging wrappers to use the new xlog_backend. Finally it makes
necessary changes to the build files to get the project compiling again.
Signed-off-by: David P. Quigley <dpquigl@tycho.nsa.gov>
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/gssd/err_util.c')
-rw-r--r-- | utils/gssd/err_util.c | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/utils/gssd/err_util.c b/utils/gssd/err_util.c index f331432..5644db6 100644 --- a/utils/gssd/err_util.c +++ b/utils/gssd/err_util.c @@ -30,64 +30,33 @@ #include <stdio.h> #include <stdarg.h> -#include <syslog.h> #include <string.h> -#include "err_util.h" +#include "xlog.h" static int verbosity = 0; static int fg = 0; -static char message_buf[500]; - void initerr(char *progname, int set_verbosity, int set_fg) { verbosity = set_verbosity; fg = set_fg; if (!fg) - openlog(progname, LOG_PID, LOG_DAEMON); + xlog_open(progname); } void printerr(int priority, char *format, ...) { va_list args; - int ret; - int buf_used, buf_available; - char *buf; /* Don't bother formatting a message we're never going to print! */ if (priority > verbosity) return; - buf_used = strlen(message_buf); - /* subtract 4 to leave room for "...\n" if necessary */ - buf_available = sizeof(message_buf) - buf_used - 4; - buf = message_buf + buf_used; - - /* - * Aggregate lines: only print buffer when we get to the - * end of a line or run out of space - */ va_start(args, format); - ret = vsnprintf(buf, buf_available, format, args); + if (fg) + vfprintf(stderr, format, args); + else + xlog_backend(L_ERROR, format, args); va_end(args); - - if (ret < 0) - goto printit; - if (ret >= buf_available) { - /* Indicate we're truncating */ - strcat(message_buf, "...\n"); - goto printit; - } - if (message_buf[strlen(message_buf) - 1] == '\n') - goto printit; - return; -printit: - if (fg) { - fprintf(stderr, "%s", message_buf); - } else { - syslog(LOG_ERR, "%s", message_buf); - } - /* reset the buffer */ - memset(message_buf, 0, sizeof(message_buf)); } |