[dovecot-cvs] dovecot/src/lib compat.c,1.14,1.15 compat.h,1.21,1.22 istream-file.c,1.10,1.11

cras at procontrol.fi cras at procontrol.fi
Wed Oct 29 15:50:38 EET 2003


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

Modified Files:
	compat.c compat.h istream-file.c 
Log Message:
pread/pwrite fixes



Index: compat.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/compat.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- compat.c	5 Oct 2003 18:01:57 -0000	1.14
+++ compat.c	29 Oct 2003 13:50:36 -0000	1.15
@@ -2,6 +2,10 @@
 
 #include "lib.h"
 
+#ifdef PREAD_WRAPPERS
+#  define _XOPEN_SOURCE 500 /* Linux */
+#endif
+
 #include <stdio.h>
 #include <ctype.h>
 #include <unistd.h>
@@ -96,7 +100,7 @@
 }
 #endif
 
-#ifndef HAVE_PWRITE
+#ifndef HAVE_PREAD
 ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
 {
 	ssize_t ret;
@@ -127,5 +131,17 @@
 	if (lseek(fd, offset, SEEK_SET) < 0)
 		return -1;
 	return ret;
+}
+#endif
+
+#ifdef PREAD_WRAPPERS
+ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
+{
+	return pread(fd, buf, count, offset);
+}
+
+ssize_t my_pwrite(int fd, const void *buf, size_t count, off_t offset)
+{
+	return pwrite(fd, buf, count, offset);
 }
 #endif

Index: compat.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/compat.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- compat.h	3 Oct 2003 14:50:48 -0000	1.21
+++ compat.h	29 Oct 2003 13:50:36 -0000	1.22
@@ -94,7 +94,7 @@
 ssize_t my_writev(int fd, const struct iovec *iov, int iov_len);
 #endif
 
-#ifndef HAVE_PWRITE
+#if !defined (HAVE_PREAD) || defined (PREAD_WRAPPERS)
 #  define pread my_pread
 #  define pwrite my_pwrite
 ssize_t my_pread(int fd, void *buf, size_t count, off_t offset);

Index: istream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- istream-file.c	29 Oct 2003 13:37:02 -0000	1.10
+++ istream-file.c	29 Oct 2003 13:50:36 -0000	1.11
@@ -2,8 +2,6 @@
 
 /* @UNSAFE: whole file */
 
-#define _XOPEN_SOURCE 500 /* for pread() / Linux */
-
 #include "lib.h"
 #include "alarm-hup.h"
 #include "istream-internal.h"



More information about the dovecot-cvs mailing list