aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/seccomp.c2
-rw-r--r--src/util.c25
2 files changed, 5 insertions, 22 deletions
diff --git a/src/seccomp.c b/src/seccomp.c
index fbc5a33..9f9a5fe 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -72,7 +72,7 @@ enable_setter_seccomp (void)
/* Process ALLOWs as quickly as possible */
SC_ALLOW (read),
SC_ALLOW (write),
- SC_ALLOW (pwritev),
+ SC_ALLOW (pwrite64),
SC_ALLOW (settimeofday),
SC_ALLOW (ioctl), /* TODO(wad) filter for fd and RTC_SET_TIME */
diff --git a/src/util.c b/src/util.c
index 6bb279c..71ed0d6 100644
--- a/src/util.c
+++ b/src/util.c
@@ -23,7 +23,6 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
-#include <sys/uio.h>
#include <sys/wait.h>
#include <syslog.h>
#include <time.h>
@@ -286,16 +285,8 @@ int rtc_close(struct rtc_handle *handle)
int file_write(int fd, void *buf, size_t sz)
{
- struct iovec iov[1];
- ssize_t ret;
- iov[0].iov_base = buf;
- iov[0].iov_len = sz;
- ret = IGNORE_EINTR (pwritev (fd, iov, 1, 0));
- if (ret != sz)
- {
- return -1;
- }
- return 0;
+ ssize_t ret = IGNORE_EINTR (pwrite (fd, buf, sz, 0));
+ return (ret >= 0 && ((size_t) ret) == sz ? 0 : -1);
}
int file_open(const char *path, int write, int cloexec)
@@ -329,16 +320,8 @@ int file_close(int fd)
int file_read(int fd, void *buf, size_t sz)
{
- struct iovec iov[1];
- iov[0].iov_base = buf;
- iov[0].iov_len = sz;
- if (preadv (fd, iov, 1, 0) != sz)
- {
- /* Returns -1 on read failure */
- return -1;
- }
- /* Returns 0 on a successful buffer fill. */
- return 0;
+ ssize_t ret = IGNORE_EINTR (pread (fd, buf, sz, 0));
+ return (ret >= 0 && ((size_t) ret) == sz ? 0 : -1);
}
int time_get(struct timeval *tv)