[Date Prev][Date Next] [Chronological] [Thread] [Top]

Support readonly MDB slaptools on readonly filesystems



Back-mdb needs this test, copied from libmdb, to make use of the
libmdb support for read-only filesystems.

I don't know if Windows sets errno=EROFS for fopen(fname, "w") when
fname is on a read-only FS, if so the #ifndef _WIN32 is unnecessary.

--- servers/slapd/back-mdb/config.c
+++ servers/slapd/back-mdb/config.c
@@ -561,3 +561,8 @@ mdb_cf_gen( ConfigArgs *c )
   	  ch_free( testpath );
-	  	   if ( !f ) {
+#ifndef _WIN32
+		if ( !(f || ((slapMode & SLAP_TOOL_READONLY) && errno == EROFS)) )
+#else
+		if ( !(f || ((slapMode & SLAP_TOOL_READONLY) && GetLastError() == ERROR_WRITE_PROTECT)) )
+#endif
+		{
				snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s: invalid path: %s",

-- 
Hallvard