]> git.ipfire.org Git - people/ms/dma.git/commitdiff
dma: treat seek errors as permanent errors
authorSimon Schubert <corecode@dragonflybsd.org>
Tue, 21 Jul 2009 00:28:46 +0000 (02:28 +0200)
committerSimon Schubert <corecode@dragonflybsd.org>
Tue, 21 Jul 2009 22:13:16 +0000 (00:13 +0200)
net.c

diff --git a/net.c b/net.c
index 44588156732b1a7adc6ac336ff3485b3761ff13e..652107340fae8312984cc1d91531536f8ced5112 100644 (file)
--- a/net.c
+++ b/net.c
@@ -349,6 +349,11 @@ deliver_remote(struct qitem *it, const char **errmsg)
        /* asprintf can't take const */
        void *errmsgc = __DECONST(char **, errmsg);
 
+       if (fseek(it->mailf, it->hdrlen, SEEK_SET) != 0) {
+               asprintf(errmsgc, "can not seek: %s", strerror(errno));
+               return (-1);
+       }
+
        host = strrchr(it->addr, '@');
        /* Should not happen */
        if (host == NULL) {
@@ -449,11 +454,6 @@ deliver_remote(struct qitem *it, const char **errmsg)
        send_remote_command(fd, "DATA");
        READ_REMOTE_CHECK("DATA", 3);
 
-       if (fseek(it->mailf, it->hdrlen, SEEK_SET) != 0) {
-               syslog(LOG_ERR, "remote delivery deferred: cannot seek: %s", neterr);
-               return (1);
-       }
-
        error = 0;
        while (!feof(it->mailf)) {
                if (fgets(line, sizeof(line), it->mailf) == NULL)