- summary: Changes to src/modules/im_unix.c --> Changes to src/modules/im_unix.c - Ver 1.10
For the sake of consistency, recommend the variable 'c'
in im_unix_read of src/modules/im_unix.c be changed to
'cnt'. 'cnt' is used in all the other im modules.
The following patches will make this change to the
current HEAD revision (1.62). The patch also includes
two debug messages I have found helpful.
Bob
========================
--- src/modules/im_unix.c.orig Mon Jun 16
15:18:40 2003
+++ src/modules/im_unix.c Mon Jul 7 14:08:04 2003
@@ -74,6 +74,8 @@
struct sockaddr_un sunx;
char *logger;
+ m_dprintf(MSYSLOG_INFORMATIVE, "im_unix:
initializing\n");
+
if (im == NULL || argv == NULL || (argc != 2 &&
argc != 1))
return (-1);
@@ -102,6 +104,9 @@
return (-1);
}
+ m_dprintf(MSYSLOG_INFORMATIVE, "im_unix: Socket
opened (fd %d) %s\n",
+ im->fd, logger);
+
watch_fd_input('p', im->fd , im);
return (1);
@@ -116,7 +121,7 @@
im_unix_read(i_module_t *im, int infd, m_msg_t *m)
{
struct sockaddr_un fromunix;
- int slen, r, c, mcount;
+ int slen, r, cnt, mcount;
slen = sizeof(fromunix);
@@ -159,16 +164,16 @@
m->flags = M_FLAG_PROG | M_FLAG_ADDHOST;
m->fields |= M_FIELD_FLAGS;
- c = parse_lines(m, im->buf, r, &mcount);
+ cnt = parse_lines(m, im->buf, r, &mcount);
if (mcount == 0)
m_dprintf(MSYSLOG_WARNING, "im_unix:
error parsing messages\n");
- im->blen -= c;
+ im->blen -= cnt;
/* move remaining string forward including
trailing '\0' */
if (im->blen > 0)
- memmove(im->buf, &im->buf[c], im->blen
+ 1);
+ memmove(im->buf, &im->buf[cnt],
im->blen + 1);
/* return the amount of messages parsed to be
dispatched */
return (mcount);
========================