diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 19:16:01 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 19:16:01 +0200 |
commit | 6514785f95878911b3ec88e2367234df74c14cd4 (patch) | |
tree | d5212cbe1de8c0fe15cb42e0c83c00ea6d77403c /util-linux | |
parent | 947b2391c07f8a11f7bd4658f77cd03172fc221a (diff) | |
download | busybox-w32-6514785f95878911b3ec88e2367234df74c14cd4.tar.gz busybox-w32-6514785f95878911b3ec88e2367234df74c14cd4.tar.bz2 busybox-w32-6514785f95878911b3ec88e2367234df74c14cd4.zip |
mesg: make in NOFORK
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-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; |