[Tkabber-dev] r1895 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Jan 28 00:42:37 MSK 2010


Author: sergei
Date: 2010-01-28 00:42:37 +0300 (Thu, 28 Jan 2010)
New Revision: 1895

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/custom.tcl
Log:
	* custom.tcl: Switched away from using clock clicks in generating
	  temporary file name.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2010-01-25 17:15:05 UTC (rev 1894)
+++ trunk/tkabber/ChangeLog	2010-01-27 21:42:37 UTC (rev 1895)
@@ -1,3 +1,8 @@
+2010-01-27  Sergei Golovan  <sgolovan at nes.ru>
+
+	* custom.tcl: Switched away from using clock clicks in generating
+	  temporary file name.
+
 2010-01-25  Sergei Golovan  <sgolovan at nes.ru>
 
 	* *: Added 2010 to copyright statements.

Modified: trunk/tkabber/custom.tcl
===================================================================
--- trunk/tkabber/custom.tcl	2010-01-25 17:15:05 UTC (rev 1894)
+++ trunk/tkabber/custom.tcl	2010-01-27 21:42:37 UTC (rev 1895)
@@ -749,28 +749,19 @@
 }
 
 proc ::custom::TempFile {} {
-    set chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-    set nrand_chars 10
     set maxtries 10
     set access [list RDWR CREAT EXCL TRUNC]
     set permission 0600
     set fd ""
-    set mypid [pid]
 
     for {set i 0} {$i < $maxtries} {incr i} {
-        set newname "custom"
-        for {set j 0} {$j < $nrand_chars} {incr j} {
-            append newname \
-                   [string index $chars \
-                           [expr {([clock clicks] ^ $mypid) % 62}]]
-        }
-        set newname [file join $::configdir $newname]
+        set newname [file join $::configdir custom[rand 1000000000]]
 
         if {![file exists $newname]} {
             if {![catch {open $newname $access $permission} fd]} {
                 fconfigure $fd -translation binary
                 return [list $newname $fd]
-            }
+	    }
         }
     }
     if {$fd == ""} {



More information about the Tkabber-dev mailing list