diff options
-rw-r--r-- | module/bsnmp-regex.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/module/bsnmp-regex.c b/module/bsnmp-regex.c index 4a75a7c..49bda3e 100644 --- a/module/bsnmp-regex.c +++ b/module/bsnmp-regex.c @@ -452,18 +452,14 @@ io_data (int fd, void *user_data) int len; int r, l; - fprintf(stderr, "io data\n"); - ASSERT (fd == conn->fd); line_buffer = conn->line_buffer; len = strlen (line_buffer); ASSERT (len < LINE_LENGTH); -fprintf (stderr, "going to read: "); do { r = read (fd, line_buffer + len, (LINE_LENGTH - 1) - len); -fprintf (stderr, "done: %d\n", r); /* An error, close */ if (r < 0 && errno != EAGAIN) { @@ -483,14 +479,15 @@ fprintf (stderr, "done: %d\n", r); line_buffer[len] = 0; } - /* Break really long lines */ - if (len >= LINE_LENGTH - 1) - line_buffer[len - 1] = '\n'; - for (;;) { t = strchr (line_buffer, '\n'); - if (t == NULL) - break; + if (t == NULL) { + /* Break really long lines */ + if (len >= LINE_LENGTH - 1) + t = line_buffer + len; + else + break; + } /* Break line (also DOS line) */ *t = 0; @@ -516,8 +513,6 @@ io_accept (int fd, void *unused) struct connection *conn; int nfd; -fprintf(stderr, "accepting sock\n"); - nfd = accept (fd, NULL, NULL); if (nfd < 0) { if (errno != EAGAIN || errno != EINTR) |