[rtems commit] cpukit/libcsupport/src/pwdgrp.c: Check return value
Joel Sherril
joel at rtems.org
Tue Nov 25 18:57:22 UTC 2014
Module: rtems
Branch: master
Commit: 3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade
Changeset: http://git.rtems.org/rtems/commit/?id=3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade
Author: Joel Sherrill <joel.sherrill at oarcorp.com>
Date: Mon Nov 24 14:18:16 2014 -0600
cpukit/libcsupport/src/pwdgrp.c: Check return value
Coverity Id 1255518. mkdir() could fail. Check return value and return
on failure. Behavior is similar to if open() failed while writing the
files.
---
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 e1e0866..a5526a0 100644
--- a/cpukit/libcsupport/src/pwdgrp.c
+++ b/cpukit/libcsupport/src/pwdgrp.c
@@ -61,7 +61,11 @@ static void init_file(const char *name, const char *content)
*/
static void pwdgrp_init(void)
{
- mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ int rc;
+
+ rc = mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ if ( rc != 0 )
+ return;
/*
* Initialize /etc/passwd
More information about the vc
mailing list