summaryrefslogtreecommitdiff
path: root/lib/stream.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-06-29 14:43:16 +0300
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-06-29 22:27:49 +0300
commit0e2d70760d8422e38dd4d6f8ceed2b960b0ed433 (patch)
tree4a4a7dfb21d429485b7245bc6a869b6c83bef152 /lib/stream.c
parent11dbcdd35ccf9b9978a61f6f501ab9062c9e5687 (diff)
lib: Avoid using assignments within checks
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'lib/stream.c')
-rw-r--r--lib/stream.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/stream.c b/lib/stream.c
index 904ee73b10..1557500c60 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -1097,7 +1097,8 @@ ssize_t stream_read_try(struct stream *s, int fd, size_t size)
return -1;
}
- if ((nbytes = read(fd, s->data + s->endp, size)) >= 0) {
+ nbytes = read(fd, s->data + s->endp, size);
+ if (nbytes >= 0) {
s->endp += nbytes;
return nbytes;
}
@@ -1126,9 +1127,8 @@ ssize_t stream_recvfrom(struct stream *s, int fd, size_t size, int flags,
return -1;
}
- if ((nbytes = recvfrom(fd, s->data + s->endp, size, flags, from,
- fromlen))
- >= 0) {
+ nbytes = recvfrom(fd, s->data + s->endp, size, flags, from, fromlen);
+ if (nbytes >= 0) {
s->endp += nbytes;
return nbytes;
}