Fix a stupid bug revealed by multibuild.pl
[oweals/busybox.git] / touch.c
diff --git a/touch.c b/touch.c
index 7db6c6e3383ab2156d6c1569174a44b5cc28d3e3..1718da71e28fb2d649d83f65d417b90f2633e8a9 100644 (file)
--- a/touch.c
+++ b/touch.c
@@ -3,7 +3,7 @@
  * Mini touch implementation for busybox
  *
  *
- * Copyright (C) 1999,2000 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
  *
  */
 
-#include "busybox.h"
 #include <stdio.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <utime.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "busybox.h"
 
 extern int touch_main(int argc, char **argv)
 {
@@ -42,14 +44,13 @@ extern int touch_main(int argc, char **argv)
                                create = FALSE;
                                break;
                        default:
-                               usage(touch_usage);
-                               exit(FALSE);
+                               show_usage();
                        }
                }
        }
 
        if (argc < 1) {
-               usage(touch_usage);
+               show_usage();
        }
 
        while (argc > 0) {
@@ -57,18 +58,18 @@ extern int touch_main(int argc, char **argv)
                                S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
                if (fd < 0) {
                        if (create == FALSE && errno == ENOENT)
-                               exit(TRUE);
+                               return EXIT_SUCCESS;
                        else {
-                               fatalError("%s", strerror(errno));
+                               perror_msg_and_die("%s", *argv);
                        }
                }
                close(fd);
                if (utime(*argv, NULL)) {
-                       fatalError("%s", strerror(errno));
+                       perror_msg_and_die("%s", *argv);
                }
                argc--;
                argv++;
        }
 
-       return(TRUE);
+       return EXIT_SUCCESS;
 }