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
This commit is contained in:
Jérôme Duval 2004-11-05 13:25:13 +00:00
parent 4fe4cbd39c
commit c345d00db1

View File

@ -5,13 +5,21 @@
#include <time.h>
#include <OS.h>
#include <errno.h>
// 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;
}