summaryrefslogtreecommitdiffstats
path: root/ax25ipd
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-07-28 14:26:57 +0200
committerRalf Baechle <ralf@linux-mips.org>2017-08-03 03:46:12 +0200
commitd08f3360f435f17590416857a95fa9ccfe19204c (patch)
tree0a3434ba7d43bd3d4be7081377f147da400268f1 /ax25ipd
parentb541f5ddd8936a1f2fa69d1917d6812139da0c4e (diff)
treewide: Kill assignments in if conditions.
Somewhat hard to read and the code base already has many overlong lines Found with below spatch files: @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 'ax25ipd')
-rw-r--r--ax25ipd/bpqether.c15
-rw-r--r--ax25ipd/config.c6
-rw-r--r--ax25ipd/io.c3
3 files changed, 16 insertions, 8 deletions
diff --git a/ax25ipd/bpqether.c b/ax25ipd/bpqether.c
index 0b0b57f..db02839 100644
--- a/ax25ipd/bpqether.c
+++ b/ax25ipd/bpqether.c
@@ -126,7 +126,8 @@ static int tun_alloc(char *dev)
struct ifreq ifr;
int fd, err;
- if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
+ fd = open("/dev/net/tun", O_RDWR);
+ if (fd < 0)
return -1;
memset(&ifr, 0, sizeof(ifr));
@@ -142,7 +143,8 @@ static int tun_alloc(char *dev)
ifr.ifr_name[IFNAMSIZ-1] = 0;
}
- if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
+ err = ioctl(fd, TUNSETIFF, (void *)&ifr);
+ if (err < 0) {
close(fd);
return err;
}
@@ -191,7 +193,8 @@ int open_ethertap(char *ifname)
#ifdef TRY_TUNTAP
} else {
strcpy(devname, ifname);
- if ((fd = tun_alloc(devname)) < 0) {
+ fd = tun_alloc(devname);
+ if (fd < 0) {
LOGL2("%s: %s\n", devname, strerror(errno));
return -1;
}
@@ -201,7 +204,8 @@ int open_ethertap(char *ifname)
}
ethertap_header_len = (tuntap ? ETHERTAP_HEADER_LEN_TUN : ETHERTAP_HEADER_LEN_ETHERTAP);
- if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ skfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (skfd < 0) {
perror("socket()");
close(fd);
return -1;
@@ -308,7 +312,8 @@ int set_bpq_dev_call_and_up(char *ifname)
LOGL1("found bpq device %s for %s\n", bpq_name, dev_name);
- if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ skfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (skfd < 0) {
perror("socket()");
return -1;
}
diff --git a/ax25ipd/config.c b/ax25ipd/config.c
index e0db591..ecbd1c2 100644
--- a/ax25ipd/config.c
+++ b/ax25ipd/config.c
@@ -87,7 +87,8 @@ void config_read(char *f)
else
fname=f;
- if ((cf = fopen(fname, "r")) == NULL) {
+ cf = fopen(fname, "r");
+ if (cf == NULL) {
fprintf(stderr,
"Config file %s not found or could not be opened\n",
fname);
@@ -99,7 +100,8 @@ void config_read(char *f)
while (fgets(buf, 255, cf) != NULL) {
strcpy(cbuf, buf);
lineno++;
- if ((e = parse_line(buf)) < 0) {
+ e = parse_line(buf);
+ if (e < 0) {
fprintf(stderr, "Config error at line %d: ",
lineno);
if (e == -1)
diff --git a/ax25ipd/io.c b/ax25ipd/io.c
index 56ef30f..c0db51d 100644
--- a/ax25ipd/io.c
+++ b/ax25ipd/io.c
@@ -323,7 +323,8 @@ void io_open(void)
if (i_am_unix98_pty_master) {
/* get name of pts-device */
- if ((namepts = ptsname(ttyfd)) == NULL) {
+ namepts = ptsname(ttyfd);
+ if (namepts == NULL) {
perror("Cannot get name of pts-device.");
exit(1);
}