Fossil SCM

Add missing db_unprotect() calls to backoffice.

drh 2020-08-21 15:08 sec2020
Commit c75dcc621bb0feeb51b0c8c01b1dbbf0847413b1ffe99d4afd7c8d8e31bb92a3
1 file changed +4
--- src/backoffice.c
+++ src/backoffice.c
@@ -241,10 +241,11 @@
241241
** process (1) no longer exists and the current time exceeds (2).
242242
*/
243243
static void backofficeReadLease(Lease *pLease){
244244
Stmt q;
245245
memset(pLease, 0, sizeof(*pLease));
246
+ db_unprotect(PROTECT_CONFIG);
246247
db_prepare(&q, "SELECT value FROM repository.config"
247248
" WHERE name='backoffice'");
248249
if( db_step(&q)==SQLITE_ROW ){
249250
const char *z = db_column_text(&q,0);
250251
z = backofficeParseInt(z, &pLease->idCurrent);
@@ -251,10 +252,11 @@
251252
z = backofficeParseInt(z, &pLease->tmCurrent);
252253
z = backofficeParseInt(z, &pLease->idNext);
253254
backofficeParseInt(z, &pLease->tmNext);
254255
}
255256
db_finalize(&q);
257
+ db_protect_pop();
256258
}
257259
258260
/*
259261
** Return a string that describes how long it has been since the
260262
** last backoffice run. The string is obtained from fossil_malloc().
@@ -277,15 +279,17 @@
277279
278280
/*
279281
** Write a lease to the backoffice property
280282
*/
281283
static void backofficeWriteLease(Lease *pLease){
284
+ db_unprotect(PROTECT_CONFIG);
282285
db_multi_exec(
283286
"REPLACE INTO repository.config(name,value,mtime)"
284287
" VALUES('backoffice','%lld %lld %lld %lld',now())",
285288
pLease->idCurrent, pLease->tmCurrent,
286289
pLease->idNext, pLease->tmNext);
290
+ db_protect_pop();
287291
}
288292
289293
/*
290294
** Check to see if the specified Win32 process is still alive. It
291295
** should be noted that even if this function returns non-zero, the
292296
--- src/backoffice.c
+++ src/backoffice.c
@@ -241,10 +241,11 @@
241 ** process (1) no longer exists and the current time exceeds (2).
242 */
243 static void backofficeReadLease(Lease *pLease){
244 Stmt q;
245 memset(pLease, 0, sizeof(*pLease));
 
246 db_prepare(&q, "SELECT value FROM repository.config"
247 " WHERE name='backoffice'");
248 if( db_step(&q)==SQLITE_ROW ){
249 const char *z = db_column_text(&q,0);
250 z = backofficeParseInt(z, &pLease->idCurrent);
@@ -251,10 +252,11 @@
251 z = backofficeParseInt(z, &pLease->tmCurrent);
252 z = backofficeParseInt(z, &pLease->idNext);
253 backofficeParseInt(z, &pLease->tmNext);
254 }
255 db_finalize(&q);
 
256 }
257
258 /*
259 ** Return a string that describes how long it has been since the
260 ** last backoffice run. The string is obtained from fossil_malloc().
@@ -277,15 +279,17 @@
277
278 /*
279 ** Write a lease to the backoffice property
280 */
281 static void backofficeWriteLease(Lease *pLease){
 
282 db_multi_exec(
283 "REPLACE INTO repository.config(name,value,mtime)"
284 " VALUES('backoffice','%lld %lld %lld %lld',now())",
285 pLease->idCurrent, pLease->tmCurrent,
286 pLease->idNext, pLease->tmNext);
 
287 }
288
289 /*
290 ** Check to see if the specified Win32 process is still alive. It
291 ** should be noted that even if this function returns non-zero, the
292
--- src/backoffice.c
+++ src/backoffice.c
@@ -241,10 +241,11 @@
241 ** process (1) no longer exists and the current time exceeds (2).
242 */
243 static void backofficeReadLease(Lease *pLease){
244 Stmt q;
245 memset(pLease, 0, sizeof(*pLease));
246 db_unprotect(PROTECT_CONFIG);
247 db_prepare(&q, "SELECT value FROM repository.config"
248 " WHERE name='backoffice'");
249 if( db_step(&q)==SQLITE_ROW ){
250 const char *z = db_column_text(&q,0);
251 z = backofficeParseInt(z, &pLease->idCurrent);
@@ -251,10 +252,11 @@
252 z = backofficeParseInt(z, &pLease->tmCurrent);
253 z = backofficeParseInt(z, &pLease->idNext);
254 backofficeParseInt(z, &pLease->tmNext);
255 }
256 db_finalize(&q);
257 db_protect_pop();
258 }
259
260 /*
261 ** Return a string that describes how long it has been since the
262 ** last backoffice run. The string is obtained from fossil_malloc().
@@ -277,15 +279,17 @@
279
280 /*
281 ** Write a lease to the backoffice property
282 */
283 static void backofficeWriteLease(Lease *pLease){
284 db_unprotect(PROTECT_CONFIG);
285 db_multi_exec(
286 "REPLACE INTO repository.config(name,value,mtime)"
287 " VALUES('backoffice','%lld %lld %lld %lld',now())",
288 pLease->idCurrent, pLease->tmCurrent,
289 pLease->idNext, pLease->tmNext);
290 db_protect_pop();
291 }
292
293 /*
294 ** Check to see if the specified Win32 process is still alive. It
295 ** should be noted that even if this function returns non-zero, the
296

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button