diff options
Diffstat (limited to 'ax25rtd')
-rw-r--r-- | ax25rtd/ax25rtd.c | 14 | ||||
-rw-r--r-- | ax25rtd/config.c | 24 | ||||
-rw-r--r-- | ax25rtd/listener.c | 3 |
3 files changed, 26 insertions, 15 deletions
diff --git a/ax25rtd/ax25rtd.c b/ax25rtd/ax25rtd.c index a40cffe..99630c4 100644 --- a/ax25rtd/ax25rtd.c +++ b/ax25rtd/ax25rtd.c @@ -144,12 +144,14 @@ int main(int argc, char **argv) if (fork()) return 0; - if ((s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_AX25))) == -1) { + s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_AX25)); + if (s == -1) { perror("AX.25 socket"); return 1; } - if ((cntrl_s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + cntrl_s = socket(AF_UNIX, SOCK_STREAM, 0); + if (cntrl_s < 0) { perror("Control socket"); return 1; } @@ -215,10 +217,10 @@ int main(int argc, char **argv) } } } else if (FD_ISSET(cntrl_s, &read_fds)) { - if ((cntrl_fd = - accept(cntrl_s, - (struct sockaddr *) &cntrl_addr, - &cntrl_len)) < 0) { + cntrl_fd = accept(cntrl_s, + (struct sockaddr *)&cntrl_addr, + &cntrl_len); + if (cntrl_fd < 0) { perror("accept Control"); save_cache(); daemon_shutdown(1); diff --git a/ax25rtd/config.c b/ax25rtd/config.c index a483a15..a0d56b6 100644 --- a/ax25rtd/config.c +++ b/ax25rtd/config.c @@ -132,7 +132,8 @@ static ax25_address *get_mycall(char *port) { char *addr; - if ((addr = ax25_config_get_addr(port)) == NULL) + addr = ax25_config_get_addr(port); + if (addr == NULL) return NULL; return asc2ax(addr); @@ -146,7 +147,8 @@ static void load_ports(void) struct ifreq ifr, *ifrp; int k, fd; - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd < 0) { fprintf(stderr, "Unable to open socket\n"); exit(1); } @@ -557,13 +559,17 @@ void interpret_command(int fd, char *buf) if (!strcmp(cmd, "add")) { if (arg == NULL) return; - if ((arg2 = get_next_arg(&p)) == NULL) + arg2 = get_next_arg(&p); + if (arg2 == NULL) return; - if ((dev = get_next_arg(&p)) == NULL) + dev = get_next_arg(&p); + if (dev == NULL) return; - if ((time = get_next_arg(&p)) == NULL) + time = get_next_arg(&p); + if (time == NULL) return; - if ((config = dev_get_config(dev)) == NULL) + config = dev_get_config(dev); + if (config == NULL) return; sscanf(time, "%lx", &stamp); @@ -588,10 +594,12 @@ void interpret_command(int fd, char *buf) } else if (!strcmp(arg, "ip")) { ip = asc2ip(arg2); - if ((arg2 = get_next_arg(&p)) == NULL) + arg2 = get_next_arg(&p); + if (arg2 == NULL) return; - if ((arg = get_next_arg(&p)) == NULL) + arg = get_next_arg(&p); + if (arg == NULL) return; if (*arg == 'x') diff --git a/ax25rtd/listener.c b/ax25rtd/listener.c index 8a4ecf9..9ecb3c6 100644 --- a/ax25rtd/listener.c +++ b/ax25rtd/listener.c @@ -395,7 +395,8 @@ void ax25_receive(int sock) socklen_t asize; asize = sizeof(sa); - if ((size = recvfrom(sock, buf, sizeof(buf), 0, &sa, &asize)) < 0) { + size = recvfrom(sock, buf, sizeof(buf), 0, &sa, &asize); + if (size < 0) { perror("recvfrom"); save_cache(); daemon_shutdown(1); |