diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-02-12 17:35:53 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-02-12 17:35:53 +0100 |
commit | 84357741a6a6e6430f199b2c3f7498e0e97da9ad (patch) | |
tree | 23e8d66ede9506b94c76fb36910ca3c7dd15c74e /backend/canon-sane.c | |
parent | 302276dc1b90cfc972fb726ca94a23b18f4b0088 (diff) |
New upstream version 1.2.1upstream/1.2.1
Diffstat (limited to 'backend/canon-sane.c')
-rw-r--r-- | backend/canon-sane.c | 29 |
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); } /******************************************************************/ |