Minor refactor/cleanup

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-11-10 09:35:01 +01:00
parent a2feba69e2
commit c31a7d1031

View File

@ -103,9 +103,9 @@ static int restart = 0;
#define MAXFUNIX 20 #define MAXFUNIX 20
int nfunix; static int nfunix;
char *funixn[MAXFUNIX]; static char *funixn[MAXFUNIX];
int funix[MAXFUNIX]; static int funix[MAXFUNIX];
/* /*
* Intervals at which we flush out "message repeated" messages, * Intervals at which we flush out "message repeated" messages,
@ -218,15 +218,14 @@ int main(int argc, char *argv[])
extern char *optarg; extern char *optarg;
extern int optind; extern int optind;
struct sockaddr_storage frominet; struct sockaddr_storage frominet;
pid_t ppid = getpid();
socklen_t len; socklen_t len;
ssize_t msglen; ssize_t msglen;
int fd;
fd_set readfds; fd_set readfds;
char line[MAXLINE + 1]; pid_t ppid = getpid();
char *ptr; char *ptr;
char line[MAXLINE + 1];
int num_fds, maxfds; int num_fds, maxfds;
int i, ch; int i, fd, ch;
for (i = 0; i < MAXFUNIX; i++) { for (i = 0; i < MAXFUNIX; i++) {
funixn[i] = NULL; funixn[i] = NULL;
@ -300,7 +299,7 @@ int main(int argc, char *argv[])
break; break;
case 'p': /* path to regular log socket */ case 'p': /* path to regular log socket */
if (nfunix < MAXFUNIX) if (nfunix < (int)NELEMS(funixn))
funixn[nfunix++] = optarg; funixn[nfunix++] = optarg;
else else
fprintf(stderr, "Max log sockets reached, ignoring %s\n", optarg); fprintf(stderr, "Max log sockets reached, ignoring %s\n", optarg);
@ -439,14 +438,14 @@ int main(int argc, char *argv[])
* Add the Unix Domain Sockets to the list of read * Add the Unix Domain Sockets to the list of read
* descriptors. * descriptors.
*/ */
/* Copy master connections */
for (i = 0; i < nfunix; i++) { for (i = 0; i < nfunix; i++) {
if (funix[i] != -1) { if (funix[i] == -1)
continue;
FD_SET(funix[i], &readfds); FD_SET(funix[i], &readfds);
if (funix[i] > maxfds) if (funix[i] > maxfds)
maxfds = funix[i]; maxfds = funix[i];
} }
}
/* /*
* Add the Internet Domain Socket to the list of read * Add the Internet Domain Socket to the list of read