[dovecot-cvs] dovecot/src/lib read-full.c, NONE, 1.1 read-full.h,
NONE, 1.1 Makefile.am, 1.35, 1.36 compat.h, 1.23,
1.24 file-dotlock.c, 1.10, 1.11 file-lock.c, 1.7,
1.8 istream-data.c, 1.7, 1.8 istream-file.c, 1.15,
1.16 istream-limit.c, 1.2, 1.3 istream-mmap.c, 1.9,
1.10 macros.h, 1.14, 1.15 network.c, 1.21, 1.22 write-full.c,
1.5, 1.6 write-full.h, 1.2, 1.3
cras at procontrol.fi
cras at procontrol.fi
Tue Apr 27 23:26:25 EEST 2004
- Previous message: [dovecot-cvs] dovecot configure.in,1.152,1.153
- Next message: [dovecot-cvs] dovecot/src/imap imap-messageset.c, NONE,
1.1 imap-messageset.h, NONE, 1.1 Makefile.am, 1.24,
1.25 client.c, 1.34, 1.35 cmd-append.c, 1.32, 1.33 cmd-close.c,
1.11, 1.12 cmd-copy.c, 1.16, 1.17 cmd-create.c, 1.7,
1.8 cmd-delete.c, 1.5, 1.6 cmd-expunge.c, 1.5, 1.6 cmd-fetch.c,
1.19, 1.20 cmd-idle.c, 1.9, 1.10 cmd-list.c, 1.34,
1.35 cmd-logout.c, 1.3, 1.4 cmd-rename.c, 1.5,
1.6 cmd-search.c, 1.18, 1.19 cmd-select.c, 1.23,
1.24 cmd-sort.c, 1.13, 1.14 cmd-status.c, 1.14,
1.15 cmd-store.c, 1.21, 1.22 cmd-subscribe.c, 1.6,
1.7 cmd-thread.c, 1.5, 1.6 cmd-unselect.c, 1.3,
1.4 commands-util.c, 1.29, 1.30 imap-expunge.c, 1.1,
1.2 imap-expunge.h, 1.1, 1.2 imap-fetch-body-section.c, 1.23,
1.24 imap-fetch.c, 1.17, 1.18 imap-fetch.h, 1.5,
1.6 imap-search.c, 1.5, 1.6 imap-search.h, 1.2,
1.3 imap-sort.c, 1.9, 1.10 imap-thread.c, 1.7,
1.8 mail-storage-callbacks.c, 1.7, 1.8 namespace.c, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv29236/src/lib
Modified Files:
Makefile.am compat.h file-dotlock.c file-lock.c istream-data.c
istream-file.c istream-limit.c istream-mmap.c macros.h
network.c write-full.c write-full.h
Added Files:
read-full.c read-full.h
Log Message:
importing new index code. mbox still broken.
--- NEW FILE: read-full.c ---
/* Copyright (c) 2003 Timo Sirainen */
#include "lib.h"
#include "read-full.h"
#include <unistd.h>
int read_full(int fd, void *data, size_t size)
{
ssize_t ret;
while (size > 0) {
ret = read(fd, data, size < SSIZE_T_MAX ? size : SSIZE_T_MAX);
if (ret <= 0)
return ret;
size -= ret;
}
return 1;
}
int pread_full(int fd, void *data, size_t size, off_t offset)
{
ssize_t ret;
while (size > 0) {
ret = pread(fd, data, size < SSIZE_T_MAX ?
size : SSIZE_T_MAX, offset);
if (ret <= 0)
return ret;
size -= ret;
offset += ret;
}
return 1;
}
--- NEW FILE: read-full.h ---
#ifndef __READ_FULL_H
#define __READ_FULL_H
/* Read data from file. Returns -1 if error occured, or 0 if EOF came before
everything was read, or 1 if all was ok. */
int read_full(int fd, void *data, size_t size);
int pread_full(int fd, void *data, size_t size, off_t offset);
#endif
Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/lib/Makefile.am,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- Makefile.am 9 Nov 2003 18:26:25 -0000 1.35
+++ Makefile.am 27 Apr 2004 20:25:52 -0000 1.36
@@ -48,6 +48,7 @@
printf-upper-bound.c \
process-title.c \
randgen.c \
+ read-full.c \
restrict-access.c \
restrict-process-size.c \
safe-memset.c \
@@ -102,6 +103,7 @@
printf-upper-bound.h \
process-title.h \
randgen.h \
+ read-full.h \
restrict-access.h \
restrict-process-size.h \
safe-memset.h \
Index: compat.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/compat.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- compat.h 29 Oct 2003 14:19:28 -0000 1.23
+++ compat.h 27 Apr 2004 20:25:52 -0000 1.24
@@ -81,6 +81,11 @@
# define fdatasync fsync
#endif
+struct const_iovec {
+ const void *iov_base;
+ size_t iov_len;
+};
+
#ifndef HAVE_STRUCT_IOVEC
struct iovec {
void *iov_base;
Index: file-dotlock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- file-dotlock.c 20 Oct 2003 06:18:58 -0000 1.10
+++ file-dotlock.c 27 Apr 2004 20:25:52 -0000 1.11
@@ -399,6 +399,7 @@
if (dotlock->ino != st.st_ino ||
!CMP_DEV_T(dotlock->dev, st.st_dev)) {
i_warning("Our dotlock file %s was overridden", lock_path);
+ errno = EEXIST;
return 0;
}
@@ -447,12 +448,15 @@
{
struct stat st, st2;
const char *lock_path;
+ int old_errno;
lock_path = t_strconcat(path, ".lock", NULL);
if (verify_owner) {
if (fstat(fd, &st) < 0) {
+ old_errno = errno;
i_error("fstat(%s) failed: %m", lock_path);
(void)close(fd);
+ errno = old_errno;
return -1;
}
}
@@ -471,6 +475,7 @@
!CMP_DEV_T(st.st_dev, st2.st_dev)) {
i_warning("Our dotlock file %s was overridden",
lock_path);
+ errno = EEXIST;
return 0;
}
}
@@ -486,11 +491,14 @@
{
struct dotlock dotlock;
struct stat st;
+ int old_errno;
if (fstat(fd, &st) < 0) {
+ old_errno = errno;
i_error("fstat(%s) failed: %m",
t_strconcat(path, ".lock", NULL));
(void)close(fd);
+ errno = old_errno;
return -1;
}
Index: file-lock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/file-lock.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- file-lock.c 26 Aug 2003 21:18:16 -0000 1.7
+++ file-lock.c 27 Apr 2004 20:25:52 -0000 1.8
@@ -30,6 +30,7 @@
else {
alarm_hup_init();
timeout_time = time(NULL) + timeout;
+ alarm(timeout);
}
fl.l_type = lock_type;
Index: istream-data.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-data.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- istream-data.c 9 Nov 2003 18:26:25 -0000 1.7
+++ istream-data.c 27 Apr 2004 20:25:53 -0000 1.8
@@ -23,9 +23,8 @@
{
}
-static ssize_t _read(struct _istream *stream)
+static ssize_t _read(struct _istream *stream __attr_unused__)
{
- stream->istream.eof = TRUE;
return -1;
}
Index: istream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- istream-file.c 12 Nov 2003 16:21:48 -0000 1.15
+++ istream-file.c 27 Apr 2004 20:25:53 -0000 1.16
@@ -152,7 +152,8 @@
}
if (ret == 0) {
/* EOF */
- stream->istream.eof = TRUE;
+ if (!fstream->file)
+ stream->istream.eof = TRUE;
return -1;
}
Index: istream-limit.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-limit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- istream-limit.c 10 Nov 2003 21:36:13 -0000 1.2
+++ istream-limit.c 27 Apr 2004 20:25:53 -0000 1.3
@@ -61,8 +61,8 @@
if (i_stream_read(lstream->input) == -2 && stream->buffer != NULL) {
if (stream->skip == 0)
return -2;
- stream->istream.eof = lstream->input->eof;
}
+ stream->istream.eof = lstream->input->eof;
stream->pos -= stream->skip;
stream->skip = 0;
Index: istream-mmap.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-mmap.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- istream-mmap.c 12 Nov 2003 16:21:48 -0000 1.9
+++ istream-mmap.c 27 Apr 2004 20:25:53 -0000 1.10
@@ -90,10 +90,8 @@
return stream->pos - stream->skip;
}
- if (stream->istream.v_offset >= mstream->v_size) {
- stream->istream.eof = TRUE;
+ if (stream->istream.v_offset >= mstream->v_size)
return -1;
- }
aligned_skip = stream->skip & ~mmap_pagemask;
if (aligned_skip == 0 && mstream->mmap_base != NULL) {
Index: macros.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/macros.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- macros.h 28 Apr 2003 16:32:20 -0000 1.14
+++ macros.h 27 Apr 2004 20:25:53 -0000 1.15
@@ -21,6 +21,11 @@
#define MEM_ALIGN(size) \
(((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1))
+#define PTR_OFFSET(ptr, offset) \
+ ((void *) (((unsigned char *) (ptr)) + (offset)))
+#define CONST_PTR_OFFSET(ptr, offset) \
+ ((const void *) (((const unsigned char *) (ptr)) + (offset)))
+
/* Don't use simply MIN/MAX, as they're often defined elsewhere in include
files that are included after this file generating tons of warnings. */
#define I_MIN(a, b) (((a) < (b)) ? (a) : (b))
Index: network.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- network.c 9 Nov 2003 20:20:36 -0000 1.21
+++ network.c 27 Apr 2004 20:25:53 -0000 1.22
@@ -579,8 +579,12 @@
int net_hosterror_notfound(int error)
{
#ifdef HAVE_IPV6
+#ifdef EAI_NODATA /* NODATA is depricated */
return error != 1 && (error == EAI_NONAME || error == EAI_NODATA);
#else
+ return error != 1 && (error == EAI_NONAME);
+#endif
+#else
return error == HOST_NOT_FOUND || error == NO_ADDRESS;
#endif
}
Index: write-full.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/write-full.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- write-full.c 26 Aug 2003 21:18:16 -0000 1.5
+++ write-full.c 27 Apr 2004 20:25:53 -0000 1.6
@@ -25,3 +25,26 @@
return 0;
}
+
+int pwrite_full(int fd, const void *data, size_t size, off_t offset)
+{
+ ssize_t ret;
+
+ while (size > 0) {
+ ret = pwrite(fd, data, size < SSIZE_T_MAX ?
+ size : SSIZE_T_MAX, offset);
+ if (ret < 0)
+ return -1;
+
+ if (ret == 0) {
+ /* nothing was written, only reason for this should
+ be out of disk space */
+ errno = ENOSPC;
+ return -1;
+ }
+ size -= ret;
+ offset += ret;
+ }
+
+ return 0;
+}
Index: write-full.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/write-full.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- write-full.h 15 Sep 2002 06:30:29 -0000 1.2
+++ write-full.h 27 Apr 2004 20:25:53 -0000 1.3
@@ -5,5 +5,6 @@
If there's not enough space in device, -1 with ENOSPC is returned, and
it's unspecified how much data was actually written. */
int write_full(int fd, const void *data, size_t size);
+int pwrite_full(int fd, const void *data, size_t size, off_t offset);
#endif
- Previous message: [dovecot-cvs] dovecot configure.in,1.152,1.153
- Next message: [dovecot-cvs] dovecot/src/imap imap-messageset.c, NONE,
1.1 imap-messageset.h, NONE, 1.1 Makefile.am, 1.24,
1.25 client.c, 1.34, 1.35 cmd-append.c, 1.32, 1.33 cmd-close.c,
1.11, 1.12 cmd-copy.c, 1.16, 1.17 cmd-create.c, 1.7,
1.8 cmd-delete.c, 1.5, 1.6 cmd-expunge.c, 1.5, 1.6 cmd-fetch.c,
1.19, 1.20 cmd-idle.c, 1.9, 1.10 cmd-list.c, 1.34,
1.35 cmd-logout.c, 1.3, 1.4 cmd-rename.c, 1.5,
1.6 cmd-search.c, 1.18, 1.19 cmd-select.c, 1.23,
1.24 cmd-sort.c, 1.13, 1.14 cmd-status.c, 1.14,
1.15 cmd-store.c, 1.21, 1.22 cmd-subscribe.c, 1.6,
1.7 cmd-thread.c, 1.5, 1.6 cmd-unselect.c, 1.3,
1.4 commands-util.c, 1.29, 1.30 imap-expunge.c, 1.1,
1.2 imap-expunge.h, 1.1, 1.2 imap-fetch-body-section.c, 1.23,
1.24 imap-fetch.c, 1.17, 1.18 imap-fetch.h, 1.5,
1.6 imap-search.c, 1.5, 1.6 imap-search.h, 1.2,
1.3 imap-sort.c, 1.9, 1.10 imap-thread.c, 1.7,
1.8 mail-storage-callbacks.c, 1.7, 1.8 namespace.c, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list