s3/printing: avoid a possible race condition in the cache timeout
authorBjörn Jacke <bj@sernet.de>
Wed, 15 Sep 2010 22:57:39 +0000 (00:57 +0200)
committerBjörn Jacke <bj@sernet.de>
Wed, 15 Sep 2010 23:00:54 +0000 (01:00 +0200)
source3/printing/printer_list.c

index d02ab88663719b5f99714f55e3bda7f5f81d958e..f52dfcffa5ff9764f0a5ec44cb68e3d9c0c56df7 100644 (file)
@@ -218,7 +218,6 @@ done:
 bool printer_list_need_refresh(void)
 {
        NTSTATUS status;
-       time_t now = time_mono(NULL);
        time_t last_refresh;
        int timediff;
 
@@ -226,7 +225,7 @@ bool printer_list_need_refresh(void)
        if (!NT_STATUS_IS_OK(status)) {
                return true;
        }
-       timediff = now - last_refresh;
+       timediff = time_mono(NULL) - last_refresh;
 
        if (timediff > 1 ) {
                /* if refresh occurred more than 1s (TODO:use lp_printcap_cache_time) ago,