From c345d00db1c3974086686b2ed40c1bc3587157b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 5 Nov 2004 13:25:13 +0000 Subject: [PATCH] added a check of permission now set errno and return -1 for errors git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9802 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/time/stime.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kernel/libroot/posix/time/stime.c b/src/kernel/libroot/posix/time/stime.c index 022e06ad97..334365e3eb 100644 --- a/src/kernel/libroot/posix/time/stime.c +++ b/src/kernel/libroot/posix/time/stime.c @@ -5,13 +5,21 @@ #include #include +#include +// ToDo: replace zero by a ROOT_UID when usergroup.c is implemented int stime(const time_t *tp) { - if (tp == NULL) - return B_ERROR; + if (tp == NULL) { + errno = EINVAL; + return -1; + } + if (geteuid() != 0) { + errno = EPERM; + return -1; + } set_real_time_clock(*tp); return B_OK; }