From 3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 24 Nov 2014 14:18:16 -0600 Subject: 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 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 -- cgit v1.2.3