[PATCH 2/3] main_cp.c: Ignore return value from stat()

Ryan Long ryan.long at oarcorp.com
Wed Mar 31 15:16:19 UTC 2021


CID 26051: Unchecked return value from library in main_cp().

Closes #4365
---
 cpukit/libmisc/shell/main_cp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/cpukit/libmisc/shell/main_cp.c b/cpukit/libmisc/shell/main_cp.c
index cddbc95..bb31a35 100644
--- a/cpukit/libmisc/shell/main_cp.c
+++ b/cpukit/libmisc/shell/main_cp.c
@@ -254,10 +254,17 @@ main_cp(rtems_shell_cp_globals* cp_globals, int argc, char *argv[])
 		 * the initial mkdir().
 		 */
 		if (r == -1) {
+			#ifdef __rtems__
+			if (Rflag && (Lflag || Hflag))
+				(void) stat(*argv, &tmp_stat);
+			else
+				(void) lstat(*argv, &tmp_stat);
+			#else
 			if (Rflag && (Lflag || Hflag))
 				stat(*argv, &tmp_stat);
 			else
 				lstat(*argv, &tmp_stat);
+			#endif
 
 			if (S_ISDIR(tmp_stat.st_mode) && Rflag)
 				type = DIR_TO_DNE;
-- 
1.8.3.1



More information about the devel mailing list