termux-packages/packages/coreutils/date.c.patch

15 lines
585 B
Diff
Raw Normal View History

diff -uNr coreutils-8.32/src/date.c coreutils-8.32.mod/src/date.c
--- coreutils-8.32/src/date.c 2020-01-01 16:13:12.000000000 +0200
+++ coreutils-8.32.mod/src/date.c 2021-07-30 17:57:00.571867917 +0300
@@ -559,6 +559,10 @@
if (set_date)
{
+ if (getuid() != 0)
+ {
+ die (EXIT_FAILURE, 0, "only root user can change date/time");
+ }
/* Set the system clock to the specified date, then regardless of
the success of that operation, format and print that date. */
if (settime (&when) != 0)