diff options
Diffstat (limited to 'coreutils/date.c')
-rw-r--r-- | coreutils/date.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index 2c6e1d4df..89b281646 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -58,7 +58,7 @@ | |||
58 | //config: the same format. With it on, 'date DATE' additionally supports | 58 | //config: the same format. With it on, 'date DATE' additionally supports |
59 | //config: MMDDhhmm[[YY]YY][.ss] format. | 59 | //config: MMDDhhmm[[YY]YY][.ss] format. |
60 | 60 | ||
61 | //applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP)) | 61 | //applet:IF_DATE(APPLET_NOEXEC(date, date, BB_DIR_BIN, BB_SUID_DROP, date)) |
62 | 62 | ||
63 | //kbuild:lib-$(CONFIG_DATE) += date.o | 63 | //kbuild:lib-$(CONFIG_DATE) += date.o |
64 | 64 | ||
@@ -152,12 +152,6 @@ enum { | |||
152 | OPT_HINT = (1 << 6) * ENABLE_FEATURE_DATE_ISOFMT, /* D */ | 152 | OPT_HINT = (1 << 6) * ENABLE_FEATURE_DATE_ISOFMT, /* D */ |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static void maybe_set_utc(int opt) | ||
156 | { | ||
157 | if (opt & OPT_UTC) | ||
158 | putenv((char*)"TZ=UTC0"); | ||
159 | } | ||
160 | |||
161 | #if ENABLE_LONG_OPTS | 155 | #if ENABLE_LONG_OPTS |
162 | static const char date_longopts[] ALIGN1 = | 156 | static const char date_longopts[] ALIGN1 = |
163 | "rfc-822\0" No_argument "R" | 157 | "rfc-822\0" No_argument "R" |
@@ -170,6 +164,19 @@ static const char date_longopts[] ALIGN1 = | |||
170 | ; | 164 | ; |
171 | #endif | 165 | #endif |
172 | 166 | ||
167 | /* We are a NOEXEC applet. | ||
168 | * Obstacles to NOFORK: | ||
169 | * - we change env | ||
170 | * - xasprintf result not freed | ||
171 | * - after xasprintf we use other xfuncs | ||
172 | */ | ||
173 | |||
174 | static void maybe_set_utc(int opt) | ||
175 | { | ||
176 | if (opt & OPT_UTC) | ||
177 | putenv((char*)"TZ=UTC0"); | ||
178 | } | ||
179 | |||
173 | int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 180 | int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
174 | int date_main(int argc UNUSED_PARAM, char **argv) | 181 | int date_main(int argc UNUSED_PARAM, char **argv) |
175 | { | 182 | { |