summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat/files/db/pwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/libnbcompat/files/db/pwrite.c')
-rw-r--r--pkgtools/libnbcompat/files/db/pwrite.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgtools/libnbcompat/files/db/pwrite.c b/pkgtools/libnbcompat/files/db/pwrite.c
new file mode 100644
index 00000000000..d5dcbd52b4f
--- /dev/null
+++ b/pkgtools/libnbcompat/files/db/pwrite.c
@@ -0,0 +1,12 @@
+/* $NetBSD: pwrite.c,v 1.1 2010/04/20 00:32:23 joerg Exp $ */
+
+static ssize_t
+working_pwrite(int fd, const void *buf, size_t nbytes, off_t off)
+{
+ if (lseek(fd, off, SEEK_SET) == -1)
+ return -1;
+ return write(fd, buf, nbytes);
+}
+
+#undef pwrite
+#define pwrite(fd, buf, nbytes, off) working_pwrite(fd, buf, nbytes,off)