[rtems commit] print-ls.c: Unused value (CID #1255346)

Joel Sherrill joel at rtems.org
Thu Apr 8 23:02:02 UTC 2021


Module:    rtems
Branch:    master
Commit:    0b2366024d1350b2defc27d5a8669da4dd7a56f1
Changeset: http://git.rtems.org/rtems/commit/?id=0b2366024d1350b2defc27d5a8669da4dd7a56f1

Author:    Ryan Long <ryan.long at oarcorp.com>
Date:      Fri Mar 12 15:25:40 2021 -0500

print-ls.c: Unused value (CID #1255346)

CID 1255346: Unused value in rtems_shell_ls_printacol().

Closes #4340

---

 cpukit/libmisc/shell/print-ls.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/cpukit/libmisc/shell/print-ls.c b/cpukit/libmisc/shell/print-ls.c
index 15702b4..95a2cdf 100644
--- a/cpukit/libmisc/shell/print-ls.c
+++ b/cpukit/libmisc/shell/print-ls.c
@@ -325,7 +325,16 @@ printacol(rtems_shell_ls_globals* globals, DISPLAY *dp)
 		if (IS_NOPRINT(p))
 			continue;
 		if (col >= numcols) {
+		#ifdef __rtems__
+		/*
+		 * chcnt is not using the value that it has been assigned
+		 * before being used again, resulting in a Coverity issue.
+		 * See CID 1255346
+		 */
+			col = 0;
+		#else
 			chcnt = col = 0;
+		#endif
 			(void)putchar('\n');
 		}
 		chcnt = printaname(globals, p, dp->s_inode,



More information about the vc mailing list