Can anyone think of a better way to handle ENAMETOOLONG on systems that 
have limited filename lengths?

On QNX, filenames are limited to 48 bytes.

--- /home/local/lib/ruby/1.8/tempfile.rb        2003-07-23 
09:44:54.000000000 -0700
+++ tempfile.rb 2004-03-10 19:22:22.000000000 -0800
@@ -40,6 +40,9 @@
         File.exist?(lock) or File.exist?(tmpname)

        Dir.mkdir(lock)
+    rescue Errno::ENAMETOOLONG
+      basename = basename[1..-1]
+      retry
      rescue
        failure += 1
        retry if failure < MAX_TRY