summaryrefslogtreecommitdiff
path: root/main/SAPI.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/SAPI.c')
-rw-r--r--main/SAPI.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index d1c684f1e1..e1b329daee 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -19,6 +19,7 @@
*/
#include <ctype.h>
+#include <sys/stat.h>
#include "php.h"
#include "SAPI.h"
@@ -383,3 +384,21 @@ SAPI_API int sapi_flush()
return FAILURE;
}
}
+
+SAPI_API int sapi_get_uid()
+{
+ SLS_FETCH();
+
+ if (sapi_module.get_uid) {
+ return sapi_module.get_uid(SLS_C);
+ } else {
+ struct stat statbuf;
+
+ if (!SG(request_info).path_translated || (stat(SG(request_info).path_translated, &statbuf)==-1)) {
+ return -1;
+ }
+
+ stat(SG(request_info).path_translated, &statbuf);
+ return statbuf.st_uid;
+ }
+}