]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't underflow usage when it is unknown and a file is removed
authorteor <teor2345@gmail.com>
Sun, 28 May 2017 12:16:00 +0000 (22:16 +1000)
committerteor <teor2345@gmail.com>
Sun, 28 May 2017 12:16:00 +0000 (22:16 +1000)
Part of #22424.

src/common/storagedir.c

index 9140ed29bdef517f739e1b166f6a87fc7bf8c8d5..532fa2a2c8aba914e79b1bf01c2a27b6b362fc75 100644 (file)
@@ -425,7 +425,7 @@ storage_dir_remove_file(storage_dir_t *d,
     }
   }
   if (unlink(ipath) == 0) {
-    if (! BUG(d->usage < size)) {
+    if (d->usage_known && ! BUG(d->usage < size)) {
       d->usage -= size;
     }
   } else {