From 81cb74af2e580d29cff01543119f646c3f4ff987 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 23 Jul 2007 09:18:52 +0000 Subject: fixed a very nasty bug in structure creation of struct filed (caused omusrmsg to be defunct) - many thanks to maharaja for providing the right idea at the right time ;) --- omusrmsg.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'omusrmsg.c') diff --git a/omusrmsg.c b/omusrmsg.c index f03a0806..eb3c15be 100644 --- a/omusrmsg.c +++ b/omusrmsg.c @@ -27,6 +27,7 @@ * A copy of the GPL can be found in the file "COPYING" in this distribution. */ #include "config.h" +#include "rsyslog.h" #include #include #include @@ -44,10 +45,10 @@ #else #include #endif -#include "rsyslog.h" -#include "syslogd.h" -#include "syslogd-types.h" #include "srUtils.h" +#include "stringbuf.h" +#include "syslogd-types.h" +#include "syslogd.h" #include "omusrmsg.h" @@ -104,7 +105,7 @@ void endutent(void) * Adjust the size of a variable to prevent a buffer overflow * should _PATH_DEV ever contain something different than "/dev/". */ -static void wallmsg(register selector_t *f) +static void wallmsg(selector_t *f) { char p[sizeof(_PATH_DEV) + UNAMESZ]; @@ -120,8 +121,6 @@ static void wallmsg(register selector_t *f) return; iovCreate(f); /* init the iovec */ -printf("gen iIovUsed %d\n", f->f_iIovUsed); -printf("iovUsed address: %x, size %d\n",&f->f_iIovUsed, sizeof(selector_t)); /* open the user login file */ setutent(); @@ -181,19 +180,13 @@ printf("iovUsed address: %x, size %d\n",&f->f_iIovUsed, sizeof(selector_t)); (void) signal(SIGALRM, endtty); (void) alarm(15); /* open the terminal */ -//errno = 0; ttyf = open(p, O_WRONLY|O_NOCTTY); -printf("try tty '%s' open: %d\n", p, ttyf); if (ttyf >= 0) { -printf("tty open!\n"); struct stat statb; if (fstat(ttyf, &statb) == 0 && (statb.st_mode & S_IWRITE)) { -int written; - // (void) writev(ttyf, f->f_iov, f->f_iIovUsed); - written = writev(ttyf, f->f_iov, f->f_iIovUsed); -printf("write tty %d bytes, iIovUsed %d\n", written, f->f_iIovUsed); + (void) writev(ttyf, f->f_iov, f->f_iIovUsed); } close(ttyf); ttyf = -1; -- cgit