vppinfra: fix coverity issue CID 323952
Type: fix
Fixes: 08600ccfa
Change-Id: I53ba0d96507b55ab7cd735073d6c4cf20a3cc948
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
diff --git a/src/vppinfra/unix-misc.c b/src/vppinfra/unix-misc.c
index 2918fc3..6a7328b 100644
--- a/src/vppinfra/unix-misc.c
+++ b/src/vppinfra/unix-misc.c
@@ -148,11 +148,11 @@
r = readlink ((char *) link, buffer, sizeof (buffer) - 1);
vec_free (link);
- buffer[r] = 0;
if (r < 1)
return 0;
+ buffer[r] = 0;
p = buffer + r - 1;
while (p > buffer && p[-1] != '/')
p--;