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)
libexec/dma/net.c

index 4458815..6521073 100644 (file)
@@ -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)