Make sure we pull in errno.h for all files in sane-backends that use

errno. This is a requirement on OpenBSD now that errno is stored in the
TIB; most uses have already been taken care of, but this slipped through
the cracks as it only provides a dlopen()'d module rather than object
code which is linked during build.  ok guenther@ ajacoutot@

Note to readers, if you see "undefined symbol 'errno'" messages when you
run or use programs on OpenBSD following this change (libc 87.0 etc.),
please report them, even if the program appears to otherwise run normally.
This commit is contained in:
sthen 2016-05-18 20:02:27 +00:00
parent 12d284b187
commit cc4b468c4f
11 changed files with 145 additions and 7 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.75 2016/04/04 22:57:45 naddy Exp $
# $OpenBSD: Makefile,v 1.76 2016/05/18 20:02:27 sthen Exp $
BROKEN-alpha= ICE hp5590.c:1141: error: unrecognizable insn
COMMENT= API for accessing scanners, backends
DISTNAME= sane-backends-1.0.25
REVISION= 3
REVISION= 4
SHARED_LIBS += sane 2.0 # unknown

View File

@ -1,7 +1,17 @@
$OpenBSD: patch-backend_canon-sane_c,v 1.1 2015/10/09 07:06:52 ajacoutot Exp $
--- backend/canon-sane.c.orig Thu Oct 8 08:07:40 2015
+++ backend/canon-sane.c Thu Oct 8 08:08:10 2015
@@ -858,10 +858,10 @@ sane_control_option (SANE_Handle handle, SANE_Int opti
$OpenBSD: patch-backend_canon-sane_c,v 1.2 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/canon-sane.c.orig Sun Aug 25 22:22:58 2013
+++ backend/canon-sane.c Wed May 18 14:01:04 2016
@@ -1,3 +1,5 @@
+#include <errno.h>
+
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback UNUSEDARG authorize)
{
@@ -858,10 +860,10 @@ sane_control_option (SANE_Handle handle, SANE_Int opti
if (status == SANE_STATUS_GOOD)
{
time (&(s->time1));
@ -15,7 +25,7 @@ $OpenBSD: patch-backend_canon-sane_c,v 1.1 2015/10/09 07:06:52 ajacoutot Exp $
DBG (11, "switch_preview = %d\n", s->switch_preview);
if (s->switch_preview == 0)
@@ -875,7 +875,7 @@ sane_control_option (SANE_Handle handle, SANE_Int opti
@@ -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));

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-backend_genesys_low_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/genesys_low.c.orig Wed May 18 14:00:59 2016
+++ backend/genesys_low.c Wed May 18 14:01:20 2016
@@ -1,3 +1,5 @@
+#include <errno.h>
+
/* sane - Scanner Access Now Easy.
Copyright (C) 2010-2013 Stéphane Voltz <stef.dev@free.fr>

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-backend_gt68xx_low_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/gt68xx_low.c.orig Wed May 18 13:59:02 2016
+++ backend/gt68xx_low.c Wed May 18 13:59:11 2016
@@ -54,6 +54,7 @@
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#ifdef USE_FORK
#include <sys/wait.h>

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-backend_p5_device_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/p5_device.c.orig Wed May 18 13:59:20 2016
+++ backend/p5_device.c Wed May 18 13:59:30 2016
@@ -1,3 +1,5 @@
+#include <errno.h>
+
/**
* Description of the Primax PagePartner model
*/

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-backend_pint_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/pint.c.orig Wed May 18 13:58:36 2016
+++ backend/pint.c Wed May 18 13:58:48 2016
@@ -44,7 +44,7 @@
#include <limits.h>
#include <stdlib.h>
#include <string.h>
-extern int errno;
+#include <errno.h>
#include "../include/sane/sane.h"
#include "../include/sane/saneopts.h"

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-backend_plustek-usb_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/plustek-usb.c.orig Wed May 18 14:00:59 2016
+++ backend/plustek-usb.c Wed May 18 14:01:09 2016
@@ -1,3 +1,5 @@
+#include <errno.h>
+
/*.............................................................................
* Project : SANE library for Plustek flatbed scanners.
*.............................................................................

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-backend_sm3600-scanusb_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/sm3600-scanusb.c.orig Wed May 18 14:00:07 2016
+++ backend/sm3600-scanusb.c Wed May 18 14:00:14 2016
@@ -51,6 +51,7 @@
====================================================================== */
+#include <errno.h>
#include "sm3600-scantool.h"
/* **********************************************************************

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-backend_snapscan-mutex_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/snapscan-mutex.c.orig Wed May 18 13:57:39 2016
+++ backend/snapscan-mutex.c Wed May 18 13:58:15 2016
@@ -69,6 +69,7 @@ static void snapscani_mutex_unlock(snapscan_mutex_t* a
#elif defined USE_PTHREAD || defined HAVE_OS2_H
+#include <errno.h>
#include <pthread.h>
#define snapscan_mutex_t pthread_mutex_t

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-backend_snapscan-sources_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/snapscan-sources.c.orig Wed May 18 14:00:59 2016
+++ backend/snapscan-sources.c Wed May 18 14:01:15 2016
@@ -1,3 +1,5 @@
+#include <errno.h>
+
/* sane - Scanner Access Now Easy.
Copyright (C) 1997, 1998, 2002, 2013 Franck Schnefra, Michel Roelofs,

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-backend_snapscan-usb_c,v 1.1 2016/05/18 20:02:27 sthen Exp $
errno.h header is required now that errno is a per-thread variable.
"undefined symbol 'errno'" at runtime with dlopen()'d modules.
--- backend/snapscan-usb.c.orig Sat Feb 23 02:00:56 2013
+++ backend/snapscan-usb.c Wed May 18 14:02:25 2016
@@ -73,6 +73,7 @@
#include "snapscan-usb.h"
#include "snapscan-mutex.c"
+#include <errno.h>
#ifndef SHM_R
#define SHM_R 0