[Pkg-shadow-devel] [PATCH v2 4/5] commonio_open: O_RDWR, implies O_CREAT. Thus all databases are created, if missing.

Dimitri John Ledkov dimitri.j.ledkov at intel.com
Wed Apr 1 12:43:30 UTC 2015


---
 lib/commonio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/commonio.c b/lib/commonio.c
index b1c2771..13b8e75 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
@@ -638,6 +638,11 @@ int commonio_open (struct commonio_db *db, int mode)
 	 * If O_CREAT was specified and the file didn't exist, it will be
 	 * created by commonio_close().  We have no entries to read yet.  --marekm
 	 */
+
+	// O_RDWR implies O_CREAT
+	if ((flags & O_RDWR) != 0) {
+		flags |= O_CREAT;
+	}
 	if (NULL == db->fp) {
 		if (((flags & O_CREAT) != 0) && (ENOENT == errno)) {
 			db->isopen = true;
-- 
2.1.0




More information about the Pkg-shadow-devel mailing list