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

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


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

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

pwdgrp.c: Fix Unchecked return value from library (CID #1255518)

CID 1255518: Unchecked return value from library in pwdgrp_init().

Closes #4282

---

 cpukit/libcsupport/src/pwdgrp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpukit/libcsupport/src/pwdgrp.c b/cpukit/libcsupport/src/pwdgrp.c
index a97d397..f4a10f7 100644
--- a/cpukit/libcsupport/src/pwdgrp.c
+++ b/cpukit/libcsupport/src/pwdgrp.c
@@ -36,6 +36,7 @@
 #include <stdint.h>
 
 #include <rtems/seterr.h>
+#include <rtems/score/assert.h>
 
 #include "pwdgrp.h"
 
@@ -62,10 +63,13 @@ static void init_file(const char *name, const char *content)
  */
 static void pwdgrp_init(void)
 {
+  int sc;
+
   /*
    * Do the best to create this directory.
    */
-  mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+  sc = mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+  _Assert_Unused_variable_equals(sc, 0);
 
   /*
    *  Initialize /etc/passwd



More information about the vc mailing list