]> diplodocus.org Git - nmh/blobdiff - uip/mkstemp.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / mkstemp.c
index 7dc806562a11ea23415157c021c28503947cbaa4..f28ccf242a1b68d349bc1c807b5abd7fdb14e2c0 100644 (file)
 #include <string.h>
 #include <stdio.h>
 
 #include <string.h>
 #include <stdio.h>
 
-#include <h/utils.h>
-
 #if ! defined HAVE_MKSTEMPS
 #   define HAVE_MKSTEMPS 0
 #endif /* ! HAVE_MKSTEMPS */
 
 #if ! defined HAVE_MKSTEMPS
 #   define HAVE_MKSTEMPS 0
 #endif /* ! HAVE_MKSTEMPS */
 
-char *build_template(const char *, const char *, const char *);
-void process_args(int, char **, const char **, const char **, const char **);
+static char *build_template(const char *, const char *, const char *);
+static void process_args(int, char **, const char **, const char **, const char **);
 
 /*
  * Use a template of the form:
 
 /*
  * Use a template of the form:
@@ -68,7 +66,7 @@ main(int argc, char *argv[]) {
 }
 
 
 }
 
 
-char *
+static char *
 build_template(const char *directory, const char *prefix, const char *suffix) {
     const char pattern[] = "XXXXXX";
     size_t len, directory_len, pathsep_len, prefix_len, suffix_len;
 build_template(const char *directory, const char *prefix, const char *suffix) {
     const char pattern[] = "XXXXXX";
     size_t len, directory_len, pathsep_len, prefix_len, suffix_len;
@@ -120,6 +118,7 @@ build_template(const char *directory, const char *prefix, const char *suffix) {
 
 #if NMH
 #include <h/mh.h>
 
 #if NMH
 #include <h/mh.h>
+#include <h/utils.h>
 
 #if HAVE_MKSTEMPS
 #   define MHFIXMSG_SWITCHES \
 
 #if HAVE_MKSTEMPS
 #   define MHFIXMSG_SWITCHES \
@@ -144,7 +143,7 @@ DEFINE_SWITCH_ENUM(MHFIXMSG);
 DEFINE_SWITCH_ARRAY(MHFIXMSG, switches);
 #undef X
 
 DEFINE_SWITCH_ARRAY(MHFIXMSG, switches);
 #undef X
 
-void
+static void
 process_args(int argc, char **argv, const char **directory,
              const char **prefix, const char **suffix) {
     char **argp, **arguments, *cp, buf[100];
 process_args(int argc, char **argv, const char **directory,
              const char **prefix, const char **suffix) {
     char **argp, **arguments, *cp, buf[100];
@@ -208,7 +207,7 @@ process_args(int argc, char **argv, const char **directory,
     }
 }
 #else  /* ! NMH */
     }
 }
 #else  /* ! NMH */
-void
+static void
 process_args(int argc, char **argv, const char **directory,
              const char **prefix, const char **suffix) {
 #   if HAVE_MKSTEMPS
 process_args(int argc, char **argv, const char **directory,
              const char **prefix, const char **suffix) {
 #   if HAVE_MKSTEMPS