summaryrefslogtreecommitdiffstats
path: root/netrom/netromd.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-07-28 14:10:07 +0200
committerRalf Baechle <ralf@linux-mips.org>2017-07-31 04:29:44 +0200
commitdaba307035faf4cc01f1ccb883b21281d91234cc (patch)
treeedbd5df9285303f281524fac8064866057ce35ce /netrom/netromd.c
parent71b0582584ac5de97141ea207ddf17f7c938b2df (diff)
treewide: Kill assignments in if conditions.
Somewhat hard to read and the code base already has many overlong lines. Found with below spatch file and some manual editing in ax25/access.c to restore a comment lost by spatch. @parens@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'netrom/netromd.c')
-rw-r--r--netrom/netromd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/netrom/netromd.c b/netrom/netromd.c
index 13737d8..dccba71 100644
--- a/netrom/netromd.c
+++ b/netrom/netromd.c
@@ -57,13 +57,15 @@ static int bcast_config_load_ports(void)
char buffer[255], port[32], *s;
FILE *fp;
- if ((fp = fopen(CONF_NETROMD_FILE, "r")) == NULL) {
+ fp = fopen(CONF_NETROMD_FILE, "r");
+ if (fp == NULL) {
fprintf(stderr, "netromd: cannot open config file\n");
return -1;
}
while (fgets(buffer, 255, fp) != NULL) {
- if ((s = strchr(buffer, '\n')) != NULL)
+ s = strchr(buffer, '\n');
+ if (s != NULL)
*s = '\0';
if (strlen(buffer) == 0 || buffer[0] == '#')
@@ -198,7 +200,8 @@ int main(int argc, char **argv)
ax25_aton_entry(nr_config_get_addr(NULL), (char *)&my_call);
ax25_aton_entry("NODES", (char *)&node_call);
- 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("netromd: socket");
return 1;
}
@@ -226,7 +229,9 @@ int main(int argc, char **argv)
if (FD_ISSET(s, &fdset)) {
asize = sizeof(sa);
- if ((size = recvfrom(s, buffer, sizeof(buffer), 0, &sa, &asize)) == -1) {
+ size = recvfrom(s, buffer, sizeof(buffer), 0, &sa,
+ &asize);
+ if (size == -1) {
if (logging) {
syslog(LOG_ERR, "recvfrom: %m");
closelog();