bc: convert to "G trick" - this returns bc to zero bss increase
[oweals/busybox.git] / util-linux / mesg.c
index 45c13b8e030e5fa3fe6446830ad6262b17fe8ac3..35c4ec13d64fde88f22e2c3eb9bb9fda1b0594a7 100644 (file)
@@ -6,27 +6,26 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
 //config:config MESG
-//config:      bool "mesg"
+//config:      bool "mesg (1.2 kb)"
 //config:      default y
 //config:      help
-//config:        Mesg controls access to your terminal by others. It is typically
-//config:        used to allow or disallow other users to write to your terminal
+//config:      Mesg controls access to your terminal by others. It is typically
+//config:      used to allow or disallow other users to write to your terminal
 //config:
 //config:config FEATURE_MESG_ENABLE_ONLY_GROUP
 //config:      bool "Enable writing to tty only by group, not by everybody"
 //config:      default y
 //config:      depends on MESG
 //config:      help
-//config:        Usually, ttys are owned by group "tty", and "write" tool is
-//config:        setgid to this group. This way, "mesg y" only needs to enable
-//config:        "write by owning group" bit in tty mode.
+//config:      Usually, ttys are owned by group "tty", and "write" tool is
+//config:      setgid to this group. This way, "mesg y" only needs to enable
+//config:      "write by owning group" bit in tty mode.
 //config:
-//config:        If you set this option to N, "mesg y" will enable writing
-//config:        by anybody at all. This is not recommended.
+//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
 
@@ -60,10 +59,15 @@ int mesg_main(int argc UNUSED_PARAM, char **argv)
                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;