summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/pwdgrp.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-24 14:18:16 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-25 12:57:09 -0600
commit3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade (patch)
tree5a6f4128f9c1f775a2c5abda0b99022c3b18b2bc /cpukit/libcsupport/src/pwdgrp.c
parentshell/main_blksync.c: Fix leak of file descriptor (diff)
downloadrtems-3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade.tar.bz2
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.
Diffstat (limited to 'cpukit/libcsupport/src/pwdgrp.c')
-rw-r--r--cpukit/libcsupport/src/pwdgrp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/pwdgrp.c b/cpukit/libcsupport/src/pwdgrp.c
index e1e08662d6..a5526a094d 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