[dovecot-cvs] dovecot/src/lib compat.c,1.10,1.11 compat.h,1.19,1.20

cras at procontrol.fi cras at procontrol.fi
Wed Aug 6 23:46:53 EEST 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv20510/src/lib

Modified Files:
	compat.c compat.h 
Log Message:
Added pwrite() compatibility



Index: compat.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/compat.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- compat.c	7 May 2003 08:17:31 -0000	1.10
+++ compat.c	6 Aug 2003 19:46:51 -0000	1.11
@@ -118,3 +118,19 @@
 	return (ssize_t)written;
 }
 #endif
+
+#ifndef HAVE_PWRITE
+ssize_t pread(int fd, void *buf, size_t count, off_t offset)
+{
+	if (lseek(fd, offset, SEEK_SET) < 0)
+		return -1;
+	return read(fd, buf, count);
+}
+
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
+{
+	if (lseek(fd, offset, SEEK_SET) < 0)
+		return -1;
+	return write(fd, buf, count);
+}
+#endif

Index: compat.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/compat.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- compat.h	18 May 2003 16:02:46 -0000	1.19
+++ compat.h	6 Aug 2003 19:46:51 -0000	1.20
@@ -94,6 +94,11 @@
 ssize_t my_writev(int fd, const struct iovec *iov, int iov_len);
 #endif
 
+#ifndef HAVE_PWRITE
+ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+#endif
+
 /* ctype.h isn't safe with signed chars,
    use our own instead if really needed */
 #define i_toupper(x) ((char) toupper((int) (unsigned char) (x)))



More information about the dovecot-cvs mailing list