[sane-devel] [RFC] mksotemp

Alessandro Zummo azummo-lists at towertech.it
Wed Apr 27 21:51:57 UTC 2016



 Some platforms have no mksotemp, the following
 patch should solve that. 

 However my autoconf won't generate a correct configure
 (it removes the INCLUDES statement), so I have omitted it

diff --git a/backend/pieusb_buffer.c b/backend/pieusb_buffer.c
index 0718238..9a04de9 100644
--- a/backend/pieusb_buffer.c
+++ b/backend/pieusb_buffer.c
@@ -156,7 +156,11 @@ sanei_pieusb_buffer_create(struct Pieusb_Read_Buffer* buffer, SANE_Int width, SA
     snprintf(buffer->buffer_name, L_tmpnam, "/tmp/sane.XXXXXX");
     if (buffer->data_file != 0) /* might still be open from previous invocation */
       close(buffer->data_file);
+#ifdef HAVE_MKOSTEMP
     buffer->data_file = mkostemp(buffer->buffer_name, O_RDWR | O_CREAT | O_EXCL | O_TRUNC);
+#else
+    buffer->data_file = mkstemp(buffer->buffer_name);
+#endif
     if (buffer->data_file == -1) {
         buffer->data_file = 0;
         buffer->data = NULL;
diff --git a/configure.in b/configure.in
index b55e7be..d868722 100644
--- a/configure.in
+++ b/configure.in
@@ -309,7 +309,7 @@ AC_FUNC_MMAP
 AC_CHECK_FUNCS(atexit ioperm i386_set_ioperm \
     mkdir strftime strstr strtod  \
     cfmakeraw tcsendbreak strcasecmp strncasecmp _portaccess \
-    getaddrinfo getnameinfo poll setitimer iopl getuid getpass)
+    getaddrinfo getnameinfo poll setitimer iopl getuid getpass mkostemp)
 AC_REPLACE_FUNCS(getenv isfdtype sigprocmask snprintf \
     strcasestr strdup strndup strsep usleep sleep syslog vsyslog)
 

-- 

 Best regards,

 Alessandro Zummo - CEO,
  Tower Technologies - Torino, Italy

  http://www.towertech.it




More information about the sane-devel mailing list