summaryrefslogtreecommitdiffstats
path: root/omusrmsg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-23 09:18:52 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-23 09:18:52 +0000
commit81cb74af2e580d29cff01543119f646c3f4ff987 (patch)
tree965acdbc566ff0295d62dc19752426c387508a2f /omusrmsg.c
parent8425445c2dd68d91bb62487032151f06d35c583a (diff)
downloadrsyslog-81cb74af2e580d29cff01543119f646c3f4ff987.zip
rsyslog-81cb74af2e580d29cff01543119f646c3f4ff987.tar.gz
rsyslog-81cb74af2e580d29cff01543119f646c3f4ff987.tar.xz
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 ;)
Diffstat (limited to 'omusrmsg.c')
-rw-r--r--omusrmsg.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/omusrmsg.c b/omusrmsg.c
index f03a080..eb3c15b 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 <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -44,10 +45,10 @@
#else
#include <sys/msgbuf.h>
#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;