summary refs log tree commit diff
path: root/concat.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--concat.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/concat.c b/concat.c
index 82f2c84..2b1c619 100644
--- a/concat.c
+++ b/concat.c
@@ -294,15 +294,13 @@ void concatSearch(
 	if (!order) err(EX_OSERR, "calloc");
 
 	for (size_t i = 0; i < threads.len; ++i) {
+		order[i].index = i;
+		order[i].created = envelopes[i].time;
+
 		struct stat status;
 		char *path = threadPath(envelopes[i].messageID, "html");
-		int error = stat(path, &status);
-		if (error) err(EX_DATAERR, "%s", path);
+		if (!stat(path, &status)) order[i].updated = status.st_mtime;
 		free(path);
-
-		order[i].index = i;
-		order[i].created = envelopes[i].time;
-		order[i].updated = status.st_mtime;
 	}
 	qsort(order, threads.len, sizeof(*order), sortCompare);
 
@@ -322,6 +320,7 @@ void concatSearch(
 	if (error) err(EX_IOERR, "%s", path);
 
 	for (size_t i = threads.len - 1; i < threads.len; --i) {
+		if (!order[i].updated) continue;
 		const struct Envelope *envelope = &envelopes[order[i].index];
 		struct List thread = dataCheck(threads.ptr[order[i].index], List).list;
 		error = htmlSearchThread(file, envelope, thread);