]> diplodocus.org Git - nmh/blobdiff - uip/mkstemp.c
Deference char pointer to test for empty string instead of strlen(3).
[nmh] / uip / mkstemp.c
index 16ddf644ab88cb4fbeff4df3bfaa9424cf53f86c..259c3edd39de5b4c28e841de477fb4c6f93a7058 100644 (file)
@@ -48,7 +48,9 @@ main(int argc, char *argv[]) {
     if ((suffix_len = strlen(suffix)) > 0) {
 #       if HAVE_MKSTEMPS
         if ((fd = mkstemps(template, suffix_len)) < 0) { perror("mkstemps"); }
-#       endif /* HAVE_MKSTEMPS */
+#       else  /* ! HAVE_MKSTEMPS */
+        fd = 0;
+#       endif /* ! HAVE_MKSTEMPS */
     } else {
         if ((fd = mkstemp(template)) < 0) { perror("mkstemp"); }
     }
@@ -102,7 +104,7 @@ build_template(const char *directory, const char *prefix, const char *suffix) {
         tp += sizeof pattern - 1;
 
         (void) strncpy(tp, suffix, suffix_len);
-        tp += suffix_len;
+        /* tp += suffix_len; */
 
         template[len-1] = '\0';
 
@@ -148,7 +150,7 @@ process_args(int argc, char **argv, const char **directory,
     NMH_UNUSED(suffix);
 #   endif /* ! HAVE_MKSTEMPS */
 
-    if (nmh_init(argv[0], 1)) { done(NOTOK); }
+    if (nmh_init(argv[0], 2)) { done(NOTOK); }
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;