feat: unify system status codes
This commit is contained in:
1 parent
93894b8fe5
commit
8a3ffb2be1
46 files changed
+1499
-489
No files matched your search
@@ -15,6 +15,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include "../../include/montauk/statuscodes.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -2476,7 +2477,7 @@ char *getcwd(char *buf, size_t size) {
|
||||
}
|
||||
int result = (int)_mtk_syscall2(SYS_GETCWD, (long)buf, (long)size);
|
||||
if (result < 0) {
|
||||
errno = result == -2 ? ERANGE : EIO;
|
||||
errno = result == BufferTooSmall ? ERANGE : EIO;
|
||||
return NULL;
|
||||
}
|
||||
return buf;
|
||||
@@ -3566,9 +3567,10 @@ int utime(const char *path, const struct utimbuf *times) {
|
||||
times != NULL ? (long)times->modtime : 0,
|
||||
times == NULL);
|
||||
if (result == 0) return 0;
|
||||
if (result == -2) errno = ENOTSUP;
|
||||
else if (result == -3) errno = EOVERFLOW;
|
||||
else if (result == -4) errno = EIO;
|
||||
if (result == UnsupportedOp) errno = ENOTSUP;
|
||||
else if (result == InvalidArgument) errno = EOVERFLOW;
|
||||
else if (result == IoFailure) errno = EIO;
|
||||
else if (result == SystemIntegrityError) errno = EPERM;
|
||||
else errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user