summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-03-01 16:00:40 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-03-01 16:00:56 +0100
commit3030e7b5acdf7579d25dbec4827ab1ebf61e4480 (patch)
tree95d72ea803985917eeccc3bacf4aa27d852f5e86
parentMerge pull request #10690 from opensourcerouting/snap-fix-libelf (diff)
downloadfrr-3030e7b5acdf7579d25dbec4827ab1ebf61e4480.tar.xz
frr-3030e7b5acdf7579d25dbec4827ab1ebf61e4480.zip
vtysh: fix coverity issues in live-log code
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to '')
-rw-r--r--vtysh/vtysh.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 12ab4c2eb..f8c6a1fc1 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -218,9 +218,9 @@ static ssize_t vtysh_client_receive(struct vtysh_client *vclient, char *buf,
do {
ret = recvmsg(vclient->fd, &mh, 0);
- if (ret < 0 && (errno == EINTR || errno == EAGAIN))
- continue;
- } while (false);
+ if (ret >= 0 || (errno != EINTR && errno != EAGAIN))
+ break;
+ } while (true);
if (cmh->cmsg_len == CMSG_LEN(sizeof(int))) {
int fd;
@@ -3592,7 +3592,7 @@ static void vtysh_log_print(struct vtysh_client *vclient,
struct tm tm;
char ts_buf[32];
- if (hdr->prio > array_size(visual_prios))
+ if (hdr->prio >= array_size(visual_prios))
vis = &visual_prios[LOG_CRIT];
else
vis = &visual_prios[hdr->prio];
@@ -3657,6 +3657,8 @@ static void vtysh_log_read(struct thread *thread)
if (ret <= 0) {
struct timespec ts;
+ buf.text[0] = '\0'; /* coverity */
+
if (ret != 0)
snprintfrr(buf.text, sizeof(buf.text),
"log monitor connection error: %m");