/* Generic version of pwritev2.
- Copyright (C) 2017 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
+#include <errno.h>
#include <unistd.h>
#include <sys/uio.h>
/* Since we define no flags for pwritev2 just route to pwritev. */
ssize_t
-pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
+pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
int flags)
{
if (flags != 0)
return -1;
}
- return pwritev (fd, vector, count, offset);
+ if (offset == -1)
+ return __writev (fd, vector, count);
+ else
+ return pwritev (fd, vector, count, offset);
}
#endif