BOOL nt_printing_init(void)
{
- static pid_t local_pid;
const char *vstring = "INFO/version";
WERROR win_rc;
uint32 vers_id;
- if (tdb_drivers && tdb_printers && tdb_forms && local_pid == sys_getpid())
+ if ( tdb_drivers && tdb_printers && tdb_forms )
return True;
if (tdb_drivers)
return False;
}
- local_pid = sys_getpid();
-
/* handle a Samba upgrade */
tdb_lock_bystring(tdb_drivers, vstring, 0);
"HKU",
"HKCR",
NULL };
+
+#define REGVER_V1 1 /* first db version with write support */
/***********************************************************************
Open the registry data in the tdb
BOOL init_registry_db( void )
{
- static pid_t local_pid;
+ const char *vstring = "INFO/version";
+ uint32 vers_id;
- if (tdb_reg && local_pid == sys_getpid())
+ if ( tdb_reg )
return True;
/* placeholder tdb; reinit upon startup */
- tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_RDWR, 0600);
- if ( !tdb_reg )
+ if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
{
tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if ( !tdb_reg ) {
DEBUG(10,("init_registry: Successfully created registry tdb\n"));
}
- /* create the registry here */
- if ( !init_registry_data() ) {
- DEBUG(0,("init_registry: Failed to initiailize data in registry!\n"));
- return False;
+ vers_id = tdb_fetch_int32(tdb_reg, vstring);
+
+ if ( vers_id != REGVER_V1 ) {
+
+ /* create the registry here */
+
+ if ( !init_registry_data() ) {
+ DEBUG(0,("init_registry: Failed to initiailize data in registry!\n"));
+ return False;
+ }
}
- local_pid = sys_getpid();
-
return True;
}