]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
do_all_the_voodoo_here: avoid intermediary variable
authorBaptiste Daroussin <bapt@FreeBSD.org>
Sat, 15 Apr 2023 19:24:24 +0000 (21:24 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Sat, 15 Apr 2023 19:24:24 +0000 (21:24 +0200)
src/do_all_the_voodoo_here.c

index 7b50d15efe1d9866425f65a7645fb5d0d057255e..c83e3ea2ae64ef07bb8762018d00a13dd9266a61 100644 (file)
@@ -78,8 +78,7 @@ int do_all_the_voodoo_here(int infd, int outfd, int hdrfd, int footfd,
        char *hdrline, *unfolded, *unqp;
        bool hdrsadded = false;
        bool subject_present = false;
-       int localfd = dup(infd);
-       FILE *f = fdopen(localfd, "r");
+       FILE *f = fdopen(dup(infd), "r");
 
        for(;;) {
                hdrline = gethdrline(f, &unfolded);
@@ -152,9 +151,9 @@ int do_all_the_voodoo_here(int infd, int outfd, int hdrfd, int footfd,
                free(unfolded);
        }
 
-       lseek(localfd, ftello(f), SEEK_SET);
+       lseek(infd, ftello(f), SEEK_SET);
        /* Just print the rest of the mail */
-       if(dumpfd2fd(localfd, outfd) < 0) {
+       if(dumpfd2fd(infd, outfd) < 0) {
                log_error(LOG_ARGS, "Error when dumping rest of mail");
                return -1;
        }