diff options
Diffstat (limited to 'util-linux/mesg.c')
-rw-r--r-- | util-linux/mesg.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/util-linux/mesg.c b/util-linux/mesg.c index c4371eb24..91c05317e 100644 --- a/util-linux/mesg.c +++ b/util-linux/mesg.c | |||
@@ -26,7 +26,7 @@ | |||
26 | //config: If you set this option to N, "mesg y" will enable writing | 26 | //config: If you set this option to N, "mesg y" will enable writing |
27 | //config: by anybody at all. This is not recommended. | 27 | //config: by anybody at all. This is not recommended. |
28 | 28 | ||
29 | //applet:IF_MESG(APPLET(mesg, BB_DIR_USR_BIN, BB_SUID_DROP)) | 29 | //applet:IF_MESG(APPLET_NOFORK(mesg, mesg, BB_DIR_USR_BIN, BB_SUID_DROP, mesg)) |
30 | 30 | ||
31 | //kbuild:lib-$(CONFIG_MESG) += mesg.o | 31 | //kbuild:lib-$(CONFIG_MESG) += mesg.o |
32 | 32 | ||
@@ -60,10 +60,15 @@ int mesg_main(int argc UNUSED_PARAM, char **argv) | |||
60 | bb_show_usage(); | 60 | bb_show_usage(); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* We are a NOFORK applet. | ||
64 | * (Not that it's very useful, but code is trivially NOFORK-safe). | ||
65 | * Play nice. Do not leak anything. | ||
66 | */ | ||
67 | |||
63 | if (!isatty(STDIN_FILENO)) | 68 | if (!isatty(STDIN_FILENO)) |
64 | bb_error_msg_and_die("not a tty"); | 69 | bb_error_msg_and_die("not a tty"); |
65 | 70 | ||
66 | xfstat(STDIN_FILENO, &sb, "stderr"); | 71 | xfstat(STDIN_FILENO, &sb, "stdin"); |
67 | if (c == 0) { | 72 | if (c == 0) { |
68 | puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n"); | 73 | puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n"); |
69 | return EXIT_SUCCESS; | 74 | return EXIT_SUCCESS; |