ash: do not let EXIT trap to fire in `trap`
[oweals/busybox.git] / console-tools / reset.c
index f36ef544ce41608e38cec4129d4dc7c8fa505036..6917eda426c4baac59d5adab8f4e3c5eb3336fe2 100644 (file)
@@ -18,7 +18,7 @@ int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 #endif
 
 int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int reset_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+int reset_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 {
        static const char *const args[] = {
                "stty", "sane", NULL
@@ -26,7 +26,7 @@ int reset_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 
        /* no options, no getopt */
 
-       if (isatty(0) && isatty(1)) {
+       if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
                /* See 'man 4 console_codes' for details:
                 * "ESC c"                      -- Reset
                 * "ESC ( K"            -- Select user mapping
@@ -40,7 +40,7 @@ int reset_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 #if ENABLE_STTY
                return stty_main(2, (char**)args);
 #else
-               execvp("stty", args);
+               execvp("stty", (char**)args);
 #endif
        }
        return EXIT_SUCCESS;