- Rename getpty() to xgetpty() and adjust callers.
- Rewrite kbd_mode and setconsole
- Introduce and use console_make_active() and xopen_xwrite_close()
- honour buffer-reservation method as set by the user (dumpkmap, loadkmap)
- shrink rtcwake and some console-tools
Saves about 270 Bytes
diff --git a/libbb/getpty.c b/libbb/getpty.c
index 5ac9582..d43fb82 100644
--- a/libbb/getpty.c
+++ b/libbb/getpty.c
@@ -10,7 +10,7 @@
#define DEBUG 0
-int getpty(char *line)
+int xgetpty(char *line)
{
int p;
#if ENABLE_FEATURE_DEVPTS
@@ -22,7 +22,7 @@
name = ptsname(p);
if (!name) {
bb_perror_msg("ptsname error (is /dev/pts mounted?)");
- return -1;
+ goto fail;
}
safe_strncpy(line, name, GETPTY_BUFSIZE);
return p;
@@ -52,7 +52,9 @@
}
}
#endif /* FEATURE_DEVPTS */
- return -1;
+USE_FEATURE_DEVPTS( fail:)
+ bb_error_msg_and_die("open pty");
+ return -1; /* never get here */
}