Commit 303e14b5e91b152d78219ff8bbca1f9bfbbb094e

Steven McDonald 2019-09-22T16:04:05

Add missing includes for time() and ctime() These headers were implicitly used on OpenBSD, but building on Linux revealed that <time.h> wasn't included directly. diffreg.c uses ctime(), which additionally needs <sys/types.h>.

diff --git a/lib/diffreg.c b/lib/diffreg.c
index fc01cc3..ba57c9a 100644
--- a/lib/diffreg.c
+++ b/lib/diffreg.c
@@ -64,6 +64,7 @@
  *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
  */
 
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/queue.h>
@@ -79,6 +80,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 #include <limits.h>
 #include <sha1.h>
diff --git a/lib/repository.c b/lib/repository.c
index 6ee2cf1..b32361c 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <sha1.h>
 #include <string.h>
+#include <time.h>
 #include <zlib.h>
 #include <errno.h>
 #include <libgen.h>
diff --git a/lib/worktree.c b/lib/worktree.c
index aa70f13..c6ccac6 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <unistd.h>