Package: mktemp
Version: 1.6-2
Tags: patch

Since 1.6-2, mktemp rejects filename templates that do not end in "XXXXXX"
and prints a somewhat cryptic error message when you try:

 $ mktemp -d ~/temp/three.XXX
 mktemp: cannot make temp dir /home/lamby/temp/three.XXX: Invalid argument

The attached patch prints a more descriptive message in this situation. The
#define conditionals are required as the private code will set EINVAL for
other reasons.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org
       `-
diff -urNd mktemp-1.6.orig/mktemp.c mktemp-1.6/mktemp.c
--- mktemp-1.6.orig/mktemp.c    2009-03-26 19:43:22.000000000 +0000
+++ mktemp-1.6/mktemp.c 2009-03-26 19:43:34.000000000 +0000
@@ -183,6 +183,13 @@
                                (void)fprintf(stderr,
                                    "%s: cannot make temp dir %s: %s\n",
                                    __progname, tempfile, strerror(errno));
+#if MKDTEMP == mkdtemp
+                               if (errno == EINVAL) {
+                                       (void)fprintf(stderr,
+                                           "%s: last six characters of 
template must be XXXXXX\n",
+                                           __progname);
+                               }
+#endif
                        }
                        exit(1);
                }
@@ -195,6 +202,13 @@
                                (void)fprintf(stderr,
                                    "%s: cannot create temp file %s: %s\n",
                                    __progname, tempfile, strerror(errno));
+#if MKSTEMP == mkstemp
+                               if (errno == EINVAL) {
+                                       (void)fprintf(stderr,
+                                           "%s: last six characters of 
template must be XXXXXX\n",
+                                           __progname);
+                               }
+#endif
                        }
                        exit(1);
                }

Attachment: signature.asc
Description: PGP signature

Reply via email to