coreutils: date: don't fail with 'Bad system call' on settime
Notify user that only root can modify system time.
This commit is contained in:
parent
f7045ad7c5
commit
a47d342818
packages/coreutils
@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Basic file, shell and text manipulation utilities from t
|
||||
TERMUX_PKG_LICENSE="GPL-3.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=8.32
|
||||
TERMUX_PKG_REVISION=7
|
||||
TERMUX_PKG_REVISION=8
|
||||
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_SHA256=4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa
|
||||
TERMUX_PKG_DEPENDS="libandroid-support, libgmp, libiconv"
|
||||
|
14
packages/coreutils/date.c.patch
Normal file
14
packages/coreutils/date.c.patch
Normal file
@ -0,0 +1,14 @@
|
||||
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)
|
Loading…
Reference in New Issue
Block a user