summaryrefslogtreecommitdiff
path: root/backend/canon-sane.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-02-12 17:36:29 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-02-12 17:36:29 +0100
commit882fd010527b8d8823f09e19edbed3746265fa08 (patch)
treebe5c7cace6697afc753c152d13ad5145d0884a42 /backend/canon-sane.c
parent527bedac30eb120915718eb7997e6dacd583512e (diff)
parente0d94cf4d39395df1e2c6bb4d967200298c13881 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'backend/canon-sane.c')
-rw-r--r--backend/canon-sane.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/backend/canon-sane.c b/backend/canon-sane.c
index 6957aa7..e313457 100644
--- a/backend/canon-sane.c
+++ b/backend/canon-sane.c
@@ -1111,9 +1111,6 @@ sane_start (SANE_Handle handle)
u_char cbuf[2]; /* modification for FB620S */
size_t buf_size, i;
- char tmpfilename[] = "/tmp/canon.XXXXXX"; /* for FB1200S */
- char *thistmpfile; /* for FB1200S */
-
DBG (1, ">> sane_start\n");
s->tmpfile = -1; /* for FB1200S */
@@ -1121,36 +1118,18 @@ sane_start (SANE_Handle handle)
/******* making a tempfile for 1200 dpi scanning of FB1200S ******/
if (s->hw->info.model == FB1200)
{
- thistmpfile = strdup(tmpfilename);
-
- if (thistmpfile != NULL)
- {
- if (!mkstemp(thistmpfile))
- {
- DBG(1, "mkstemp(thistmpfile) is failed\n");
- return (SANE_STATUS_INVAL);
- }
- }
- else
- {
- DBG(1, "strdup(thistmpfile) is failed\n");
- return (SANE_STATUS_INVAL);
- }
-
- s->tmpfile = open(thistmpfile, O_RDWR | O_CREAT | O_EXCL, 0600);
+ char tmpfilename[] = "/tmp/canon.XXXXXX"; /* for FB1200S */
+ s->tmpfile = mkstemp(tmpfilename);
if (s->tmpfile == -1)
{
- DBG(1, "error opening temp file %s\n", thistmpfile);
+ DBG(1, "error opening temp file %s\n", tmpfilename);
DBG(1, "errno: %i; %s\n", errno, strerror(errno));
errno = 0;
return (SANE_STATUS_INVAL);
}
DBG(1, " ****** tmpfile is opened ****** \n");
-
- unlink(thistmpfile);
- free (thistmpfile);
- DBG(1, "free thistmpfile\n");
+ unlink(tmpfilename);
}
/******************************************************************/