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:
@@ -5,13 +5,21 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
// ToDo: replace zero by a ROOT_UID when usergroup.c is implemented
|
||||||
|
|
||||||
int
|
int
|
||||||
stime(const time_t *tp)
|
stime(const time_t *tp)
|
||||||
{
|
{
|
||||||
if (tp == NULL)
|
if (tp == NULL) {
|
||||||
return B_ERROR;
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (geteuid() != 0) {
|
||||||
|
errno = EPERM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
set_real_time_clock(*tp);
|
set_real_time_clock(*tp);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user