$OpenBSD: patch-backend_canon-sane_c,v 1.4 2021/04/25 06:54:52 ajacoutot Exp $

errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.

64bit time_t

Index: backend/canon-sane.c
--- backend/canon-sane.c.orig
+++ backend/canon-sane.c
@@ -1,3 +1,5 @@
+#include <errno.h>
+
 SANE_Status
 sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize)
 {
@@ -858,10 +860,10 @@ sane_control_option (SANE_Handle handle, SANE_Int opti
 	  if (status == SANE_STATUS_GOOD)
 	    {
 	      time (&(s->time1));
-	      DBG (11, "time0 = %ld\n", s->time0);
-	      DBG (11, "time1 = %ld\n", s->time1);
+	      DBG (11, "time0 = %lld\n", s->time0);
+	      DBG (11, "time1 = %lld\n", s->time1);
 	      dtime = (s->time1) - (s->time0);
-	      DBG (11, "dtime = %ld\n", dtime);
+	      DBG (11, "dtime = %lld\n", dtime);
 
 	      DBG (11, "switch_preview = %d\n", s->switch_preview);
 	      if (s->switch_preview == 0)
@@ -875,7 +877,7 @@ sane_control_option (SANE_Handle handle, SANE_Int opti
 
 	      DBG (11, "SANE_UNFIX(s->val[OPT_BR_Y].w) = %f\n",
 		   SANE_UNFIX (s->val[OPT_BR_Y].w));
-	      DBG (11, "rt = %ld\n", rt);
+	      DBG (11, "rt = %lld\n", rt);
 
 	      if (dtime < rt)
 		{
@@ -2163,7 +2165,7 @@ sane_read (SANE_Handle handle, SANE_Byte *buf, SANE_In
   else
     time (&(s->time0));
 
-  DBG (11, "sane_read: time0 = %ld\n", s->time0);
+  DBG (11, "sane_read: time0 = %lld\n", s->time0);
   s->switch_preview = s->val[OPT_PREVIEW].w;
   return (status);
 }
