summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2018-01-28 16:05:07 +0100
committerJoel Rosdahl <joel@rosdahl.net>2018-01-28 16:05:07 +0100
commit7a67b2a9b20a3934b0248026fb4d78bc3815be33 (patch)
tree597d1f5e09949947662b765eadc79a49d0ea5181
parent410f41332e1c232de74b816b078da9812a2e3024 (diff)
downloadccache-7a67b2a9b20a3934b0248026fb4d78bc3815be33.tar.gz
Only write hash debug output if there is any data
-rw-r--r--mdfour.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mdfour.c b/mdfour.c
index 36b55fe8..f557a20f 100644
--- a/mdfour.c
+++ b/mdfour.c
@@ -1,5 +1,5 @@
// Copyright (C) 1997-1998 Andrew Tridgell
-// Copyright (C) 2009-2016 Joel Rosdahl
+// Copyright (C) 2009-2018 Joel Rosdahl
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
@@ -162,7 +162,7 @@ void
mdfour_update(struct mdfour *md, const unsigned char *in, size_t n)
{
#ifdef CCACHE_DEBUG_HASH
- if (getenv("CCACHE_DEBUG_HASH")) {
+ if (n > 0 && getenv("CCACHE_DEBUG_HASH")) {
FILE *f = fopen("ccache-debug-hash.bin", "a");
fwrite(in, 1, n, f);
fclose(f);