From 370a0929ce2e08f508df76392de5617c614103ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jarom=C3=ADr=20Kon=C4=8Dick=C3=BD?= <jkoncick@redhat.com>
Date: Tue, 15 Oct 2013 21:40:20 +0200
Subject: [PATCH] make static analysis tool happy (false positive)
(cherry picked from commit ee4ec133bc5616f3d2b9efd468dfc1d42ca1c17d)
Signed-off-by: Phil Sutter <psutter@redhat.com>
---
arptables.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arptables.c b/arptables.c
index 5535ab23780d5..8ef445a4700c4 100644
--- a/arptables.c
+++ b/arptables.c
@@ -1668,10 +1668,12 @@ static char *get_modprobe(void)
ret = malloc(1024);
if (ret) {
- switch (read(procfile, ret, 1024)) {
+ int read_bytes = read(procfile, ret, 1024);
+ switch (read_bytes) {
case -1: goto fail;
case 1024: goto fail; /* Partial read. Wierd */
}
+ ret[read_bytes] = '\0';
if (ret[strlen(ret)-1]=='\n')
ret[strlen(ret)-1]=0;
close(procfile);
--
2.21.0