Author: benny
Date: 2006-07-30 22:36:35 +0000 (Sun, 30 Jul 2006)
New Revision: 22582

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/configure.in.in
   thunar/trunk/plugins/thunar-sendto-email/main.c
Log:
2006-07-31      Benedikt Meurer <[EMAIL PROTECTED]>

        * configure.in.in, plugins/thunar-sendto-email/main.c: Check for
          missing mkdtemp, and use a fallback implementation if missing
          from the system. Bug #2070.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2006-07-30 22:23:13 UTC (rev 22581)
+++ thunar/trunk/ChangeLog      2006-07-30 22:36:35 UTC (rev 22582)
@@ -1,3 +1,9 @@
+2006-07-31     Benedikt Meurer <[EMAIL PROTECTED]>
+
+       * configure.in.in, plugins/thunar-sendto-email/main.c: Check for
+         missing mkdtemp, and use a fallback implementation if missing
+         from the system. Bug #2070.
+
 2006-07-30     Benedikt Meurer <[EMAIL PROTECTED]>
 
        * thunar/thunar-tree-model.c: Emit "row-deleted" prior to deleting the

Modified: thunar/trunk/configure.in.in
===================================================================
--- thunar/trunk/configure.in.in        2006-07-30 22:23:13 UTC (rev 22581)
+++ thunar/trunk/configure.in.in        2006-07-30 22:36:35 UTC (rev 22582)
@@ -114,9 +114,9 @@
 dnl ************************************
 AC_FUNC_MMAP()
 AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr lchmod localeconv \
-                localtime_r mbrtowc mkfifo posix_madvise pread pwrite \
-                readdir_r sched_yield setgroupent setpassent statfs \
-                statvfs strcoll strlcpy strptime symlink])
+                localtime_r mbrtowc mkdtemp mkfifo posix_madvise pread \
+                pwrite readdir_r sched_yield setgroupent setpassent \
+                statfs statvfs strcoll strlcpy strptime symlink])
 
 dnl ******************************************
 dnl *** Linux/glibc specified work-arounds ***

Modified: thunar/trunk/plugins/thunar-sendto-email/main.c
===================================================================
--- thunar/trunk/plugins/thunar-sendto-email/main.c     2006-07-30 22:23:13 UTC 
(rev 22581)
+++ thunar/trunk/plugins/thunar-sendto-email/main.c     2006-07-30 22:36:35 UTC 
(rev 22582)
@@ -46,6 +46,9 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -317,6 +320,45 @@
 
 
 
+#ifndef HAVE_MKDTEMP
+static gchar*
+mkdtemp (gchar *tmpl)
+{
+  static const gchar LETTERS[] = 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+  static guint64     value;
+  guint64            v;
+  gint               len;
+  gint               i, j;
+
+  len = strlen (tmpl);
+  if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX") != 0)
+    {
+      errno = EINVAL;
+      return NULL;
+    }
+
+  value += ((guint64) time (NULL)) ^ getpid ();
+
+  for (i = 0; i < TMP_MAX; ++i, value += 7777)
+    {
+      /* fill in the random bits */
+      for (j = 0, v = value; j < 6; ++j)
+        tmpl[(len - 6) + j] = LETTERS[v % 62]; v /= 62;
+
+      /* try to create the directory */
+      if (g_mkdir (tmpl, 0700) == 0)
+        return tmpl;
+      else if (errno != EEXIST)
+        return NULL;
+    }
+
+  errno = EEXIST;
+  return NULL;
+}
+#endif
+
+
+
 static gboolean
 tse_compress (GList  *infos,
               gchar **zipfile_return)

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to