From 55cd5a9a7894a0b92d321721ce8c049cfd4b5112 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Mon, 24 Feb 2014 21:17:06 +0100
Subject: [PATCH] DirectorySave: save the mtime only if it is known

---
 src/db/DirectorySave.cxx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/db/DirectorySave.cxx b/src/db/DirectorySave.cxx
index 499f84734..614473d34 100644
--- a/src/db/DirectorySave.cxx
+++ b/src/db/DirectorySave.cxx
@@ -43,8 +43,9 @@ void
 directory_save(FILE *fp, const Directory &directory)
 {
 	if (!directory.IsRoot()) {
-		fprintf(fp, DIRECTORY_MTIME "%lu\n",
-			(unsigned long)directory.mtime);
+		if (directory.mtime != 0)
+			fprintf(fp, DIRECTORY_MTIME "%lu\n",
+				(unsigned long)directory.mtime);
 
 		fprintf(fp, "%s%s\n", DIRECTORY_BEGIN, directory.GetPath());
 	}