Hi all,

Commit 3211e8e9c0565fae8b13ba0115e3a23ad3ae8ade added error checking to
a mkdir("/etc", ...) call in pwdgrp_init().

That call might fail if the directory already exists. In my case,
because I'm tarfs-ing stuff into /etc before invoking the NFS client,
which calls pwdgrp_init().

The attached patch allows the mkdir() call to fail with EEXIST.

Cheers!
-- 
Nick Withers

Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)
From 8d0ffbc271326c64138181b895574db5e8e702ef Mon Sep 17 00:00:00 2001
From: Nick Withers <nick.with...@anu.edu.au>
Date: Fri, 20 Feb 2015 15:00:47 +1100
Subject: [PATCH] Don't fail to create passwd and group files if /etc already
 exists

---
 cpukit/libcsupport/src/pwdgrp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libcsupport/src/pwdgrp.c b/cpukit/libcsupport/src/pwdgrp.c
index a5526a0..46842f3 100644
--- a/cpukit/libcsupport/src/pwdgrp.c
+++ b/cpukit/libcsupport/src/pwdgrp.c
@@ -64,7 +64,7 @@ static void pwdgrp_init(void)
   int rc;
 
   rc = mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
-  if ( rc != 0 )
+  if ( rc != 0 && errno != EEXIST)
     return;
 
   /*
-- 
2.2.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to