]> diplodocus.org Git - nmh/commitdiff
Changed failure exit status of mkstemp(1) from 255 to 1.
authorDavid Levine <levinedl@acm.org>
Sat, 26 Aug 2017 11:30:30 +0000 (07:30 -0400)
committerDavid Levine <levinedl@acm.org>
Sat, 26 Aug 2017 11:32:21 +0000 (07:32 -0400)
For consistency, on Ralph's suggestion.

man/mh-mkstemp.man
test/mkstemp/test-mkstemp
uip/mkstemp.c

index 24a040c620c341fffc61800b362e3989fdcb1102..43ba43ea42dd07991cb766799c0f85e2ba7c31bc 100644 (file)
@@ -59,7 +59,7 @@ If
 .B mkstemp
 successfully creates the temporary file, it prints the file name on
 standard output and exits with status 0.  On failure, it prints a
-diagnostic message on standard error and exits with status 255.
+diagnostic message on standard error and exits with status 1.
 .SH "PROFILE COMPONENTS"
 None
 .SH "SEE ALSO"
index 97896e48884528a556a73ff2617a02aaea2b64fe..8e0eb83098adc851178bf6378e84b978610d26b8 100755 (executable)
@@ -21,7 +21,7 @@ actual="$MH_TEST_DIR"/$$.actual
 
 mkstemp="${MH_LIBEXEC_DIR}/mkstemp"
 
-check_exit '-eq 255' $mkstemp -
+check_exit '-eq 1' $mkstemp -
 
 $mkstemp -help | grep suffix >/dev/null  &&  has_mkstemps=1  ||  has_mkstemps=0
 
index b7acbb1460051c7ed103d8c55006ea3f16de2642..7dc806562a11ea23415157c021c28503947cbaa4 100644 (file)
@@ -44,7 +44,7 @@ main(int argc, char *argv[]) {
 
     process_args(argc, argv, &directory, &prefix, &suffix);
     if ((template = build_template(directory, prefix, suffix)) == NULL) {
-        return -1;
+        return 1;
     }
 
     if ((suffix_len = strlen(suffix)) > 0) {
@@ -64,7 +64,7 @@ main(int argc, char *argv[]) {
 
     free(template);
 
-    return fd >= 0  ?  0  :  -1;
+    return fd >= 0  ?  0  :  1;
 }
 
 
@@ -152,7 +152,7 @@ process_args(int argc, char **argv, const char **directory,
     NMH_UNUSED(suffix);
 #   endif /* ! HAVE_MKSTEMPS */
 
-    if (nmh_init(argv[0], 2)) { done(NOTOK); }
+    if (nmh_init(argv[0], 2)) { done(1); }
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
 
@@ -164,12 +164,12 @@ process_args(int argc, char **argv, const char **directory,
             switch (smatch(++cp, switches)) {
             case AMBIGSW:
                 ambigsw(cp, switches);
-                done(NOTOK);
+                done(1);
             case UNKWNSW:
                 inform("-%s unknown", cp);
                 (void) snprintf(buf, sizeof buf, "%s [switches]", invo_name);
                 print_help(buf, switches, 1);
-                done(NOTOK);
+                done(1);
             case HELPSW:
                 (void) snprintf(buf, sizeof buf, "%s [switches]", invo_name);
                 print_help(buf, switches, 1);
@@ -237,7 +237,7 @@ process_args(int argc, char **argv, const char **directory,
             exit(0);
         default:
             (void) fprintf(stderr, usage, argv[0]);
-            exit(-1);
+            exit(1);
         }
     }
 }