Fix a stupid typo -- bug found by Larry Doolittle.
[oweals/busybox.git] / logger.c
index 21906401f502c7df5cf7bc1c29902d41ce81efc9..1ab868d75f86cd7934fb768ddd009259b21c9c2a 100644 (file)
--- a/logger.c
+++ b/logger.c
@@ -2,7 +2,7 @@
 /*
  * Mini logger implementation for busybox
  *
- * Copyright (C) 1999,2000 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -27,6 +27,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 
 #if !defined BB_SYSLOGD
 
@@ -130,6 +132,7 @@ extern int logger_main(int argc, char **argv)
                while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
                        buf[i++] = c;
                }
+               buf[i++] = '\0';
                message = buf;
        } else {
                len = 1; /* for the '\0' */
@@ -147,7 +150,6 @@ extern int logger_main(int argc, char **argv)
        openlog(name, option, (pri | LOG_FACMASK));
        syslog(pri, "%s", message);
        closelog();
-
        return EXIT_SUCCESS;
 }