*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
//config:config MESG
//config: bool "mesg (1.2 kb)"
//config: default y
//config: If you set this option to N, "mesg y" will enable writing
//config: by anybody at all. This is not recommended.
-//applet:IF_MESG(APPLET(mesg, BB_DIR_USR_BIN, BB_SUID_DROP))
+//applet:IF_MESG(APPLET_NOFORK(mesg, mesg, BB_DIR_USR_BIN, BB_SUID_DROP, mesg))
//kbuild:lib-$(CONFIG_MESG) += mesg.o
bb_show_usage();
}
+ /* We are a NOFORK applet.
+ * (Not that it's very useful, but code is trivially NOFORK-safe).
+ * Play nice. Do not leak anything.
+ */
+
if (!isatty(STDIN_FILENO))
bb_error_msg_and_die("not a tty");
- xfstat(STDIN_FILENO, &sb, "stderr");
+ xfstat(STDIN_FILENO, &sb, "stdin");
if (c == 0) {
puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n");
return EXIT_SUCCESS;