[rtems commit] main_chmod.c: Fix Unchecked return value from library ( CID #1063856)

Joel Sherrill joel at rtems.org
Mon Mar 8 20:56:10 UTC 2021


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

Author:    Ryan Long <ryan.long at oarcorp.com>
Date:      Tue Mar  2 11:34:36 2021 -0500

main_chmod.c: Fix Unchecked return value from library (CID #1063856)

CID 1063856: Unchecked return value from library in
rtems_shell_main_chmod().

Closes #4281

---

 cpukit/libmisc/shell/main_chmod.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cpukit/libmisc/shell/main_chmod.c b/cpukit/libmisc/shell/main_chmod.c
index 0c39072..8b932fa 100644
--- a/cpukit/libmisc/shell/main_chmod.c
+++ b/cpukit/libmisc/shell/main_chmod.c
@@ -34,6 +34,7 @@ static int rtems_shell_main_chmod(
   int           n;
   mode_t        mode;
   unsigned long tmp;
+  int           sc;
 
   if (argc < 2) {
     fprintf(stderr,"%s: too few arguments\n", argv[0]);
@@ -52,8 +53,10 @@ static int rtems_shell_main_chmod(
   /*
    *  Now change the files modes
    */
-  for (n=2 ; n < argc ; n++)
-    chmod(argv[n++], mode);
+  for (n=2 ; n < argc ; n++) {
+    sc = chmod(argv[n++], mode);
+    _Assert_Unused_variable_unequal(sc, -1);
+  }
 
   return 0;
 }



More information about the vc mailing list