summaryrefslogtreecommitdiffstats
path: root/rose/rsuplnk.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 /rose/rsuplnk.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 'rose/rsuplnk.c')
-rw-r--r--rose/rsuplnk.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/rose/rsuplnk.c b/rose/rsuplnk.c
index 2ed59ce..ea29b74 100644
--- a/rose/rsuplnk.c
+++ b/rose/rsuplnk.c
@@ -82,7 +82,8 @@ int main(int argc, char **argv)
roseconnect.srose_ndigis = rosebind.srose_ndigis = 0;
addrlen = sizeof(struct sockaddr_rose);
- if ((addr = rs_config_get_addr(argv[1])) == NULL) {
+ addr = rs_config_get_addr(argv[1]);
+ if (addr == NULL) {
syslog(LOG_ERR, "invalid Rose port name - %s\n", argv[1]);
closelog();
return 1;
@@ -104,7 +105,8 @@ int main(int argc, char **argv)
addr = ax25_ntoa(&ax25peer.fsa_digipeater[n]);
if (strspn(addr, "0123456789-") == strlen(addr)) {
- if ((p = strchr(addr, '-')) != NULL)
+ p = strchr(addr, '-');
+ if (p != NULL)
*p = '\0';
switch (strlen(addr)) {
case 4:
@@ -168,7 +170,8 @@ int main(int argc, char **argv)
/*
* Open the socket into the kernel.
*/
- if ((s = socket(AF_ROSE, SOCK_SEQPACKET, 0)) < 0) {
+ s = socket(AF_ROSE, SOCK_SEQPACKET, 0);
+ if (s < 0) {
syslog(LOG_ERR, "cannot open ROSE socket, %s\n", strerror(errno));
closelog();
return 1;
@@ -253,7 +256,8 @@ int main(int argc, char **argv)
select(s + 1, &read_fd, NULL, NULL, NULL);
if (FD_ISSET(s, &read_fd)) {
- if ((n = read(s, buffer, 512)) == -1) {
+ n = read(s, buffer, 512);
+ if (n == -1) {
strcpy(buffer, "\r*** Disconnected - 0000 - DTE Originated\r");
write(STDOUT_FILENO, buffer, strlen(buffer));
break;
@@ -268,7 +272,8 @@ int main(int argc, char **argv)
}
if (FD_ISSET(STDIN_FILENO, &read_fd)) {
- if ((n = read(STDIN_FILENO, buffer + 2, sizeof(buffer)-2)) == -1) {
+ n = read(STDIN_FILENO, buffer + 2, sizeof(buffer) - 2);
+ if (n == -1) {
close(s);
break;
}