Fix FORTIFY crashes

This commit is contained in:
topjohnwu
2020-04-11 04:05:34 -07:00
parent e165a1e65c
commit 93ef90cd24
3 changed files with 21 additions and 3 deletions

View File

@@ -53,6 +53,14 @@ int xopenat(int dirfd, const char *pathname, int flags) {
return fd;
}
int xopenat(int dirfd, const char *pathname, int flags, mode_t mode) {
int fd = openat(dirfd, pathname, flags, mode);
if (fd < 0) {
PLOGE("openat: %s", pathname);
}
return fd;
}
ssize_t xwrite(int fd, const void *buf, size_t count) {
int ret = write(fd, buf, count);
if (count != ret) {
@@ -435,3 +443,11 @@ int xinotify_init1(int flags) {
}
return ret;
}
char *xrealpath(const char *path, char *resolved_path) {
char *ret = realpath(path, resolved_path);
if (ret == nullptr) {
PLOGE("xrealpath");
}
return ret;
}