summaryrefslogtreecommitdiff
path: root/backend/bh.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:33:06 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:33:06 +0200
commit24feb9f37f302c006ba51502da817325200e74d0 (patch)
treed4451782449e5fcbae9cbe3778c51a8c6cb3c36d /backend/bh.c
parent76b69ebb381d40458339c9940135740797cbd2d4 (diff)
parentcfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (diff)
Merge tag 'upstream/1.0.25'
Upstream version 1.0.25
Diffstat (limited to 'backend/bh.c')
-rw-r--r--backend/bh.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/backend/bh.c b/backend/bh.c
index 58c8caa..9424bd6 100644
--- a/backend/bh.c
+++ b/backend/bh.c
@@ -66,6 +66,7 @@
#define MIN(x,y) ((x)<(y) ? (x) : (y))
#define MAX(x,y) ((x)>(y) ? (x) : (y))
+static const SANE_Device **devlist = 0;
static int num_devices = 0;
static BH_Device *first_dev = NULL;
static BH_Scanner *first_handle = NULL;
@@ -1862,10 +1863,9 @@ start_scan (BH_Scanner *s)
strncpy(s->barfname, "/tmp/bhXXXXXX", sizeof(s->barfname));
s->barfname[sizeof(s->barfname)-1] = '\0';
+ fd = mkstemp(s->barfname);
- if ((mktemp(s->barfname) == NULL) &&
- ((fd = open(s->barfname, O_CREAT | O_EXCL | O_WRONLY, 0600)) != -1) &&
- ((fp = fdopen(fd, "w")) != NULL))
+ if (fd !=-1 && (fp = fdopen(fd, "w")) != NULL)
{
fprintf(fp, "<xml-stream>\n");
@@ -3231,7 +3231,6 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize)
SANE_Status
sane_get_devices (const SANE_Device ***device_list, SANE_Bool local)
{
- static const SANE_Device **devlist = 0;
BH_Device *dev;
int i;
DBG(3, "sane_get_devices called\n");
@@ -3879,5 +3878,8 @@ sane_exit (void)
next = dev->next;
free (dev);
}
+
+ if (devlist)
+ free (devlist);
}