mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Apply some touchups
This commit is contained in:
parent
9f149e1de3
commit
2f3bd90216
139 changed files with 1188 additions and 1154 deletions
|
@ -16,12 +16,12 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/struct/iovec.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/macros.h"
|
||||
#include "libc/sysv/consts/iov.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
|
@ -45,9 +45,8 @@ ssize_t pwritev(int fd, const struct iovec *iovec, int count, int64_t off) {
|
|||
static bool once, demodernize;
|
||||
int olderr;
|
||||
ssize_t rc;
|
||||
|
||||
if (!count) return 0;
|
||||
if ((count = min(count, IOV_MAX)) < 0) return einval();
|
||||
if ((count = MIN(count, IOV_MAX)) < 0) return einval();
|
||||
|
||||
/*
|
||||
* NT, XNU, and 2007-era Linux don't support this system call.
|
||||
|
@ -63,7 +62,7 @@ ssize_t pwritev(int fd, const struct iovec *iovec, int count, int64_t off) {
|
|||
demodernize = true;
|
||||
} else {
|
||||
olderr = errno;
|
||||
rc = sys_pwritev(fd, iovec, count, off);
|
||||
rc = sys_pwritev(fd, iovec, count, off, off);
|
||||
if (rc == -1 && errno == ENOSYS) {
|
||||
errno = olderr;
|
||||
demodernize = true;
|
||||
|
@ -77,7 +76,7 @@ ssize_t pwritev(int fd, const struct iovec *iovec, int count, int64_t off) {
|
|||
}
|
||||
|
||||
if (!demodernize) {
|
||||
return sys_pwritev(fd, iovec, count, off);
|
||||
return sys_pwritev(fd, iovec, count, off, off);
|
||||
} else {
|
||||
return pwrite(fd, iovec[0].iov_base, iovec[0].iov_len, off);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue