]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mlmmj-send: use asprintf instead of reinventing it
authorBaptiste Daroussin <bapt@FreeBSD.org>
Sun, 12 Feb 2023 15:16:25 +0000 (16:16 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Sun, 12 Feb 2023 15:16:25 +0000 (16:16 +0100)
src/mlmmj-send.c

index c12b861650891ac17309ffbde903c08074328d9d..bee0abfe3156840195e54553fa3a80ed8548a9fa 100644 (file)
@@ -428,7 +428,7 @@ static void print_help(const char *prg)
 
 int main(int argc, char **argv)
 {
-       size_t len = 0, hdrslen, bodylen;
+       size_t hdrslen, bodylen;
        int sockfd = -1, mailfd = 0, opt, mindex = 0, subfd = 0, tmpfd;
        int deletewhensent = 1, sendres = 0, digest = 0;
        bool archive = true, ctrlarchive;
@@ -634,10 +634,7 @@ int main(int argc, char **argv)
        /* initialize the archive filename */
        if(archive) {
                mindex = incindexfile(ml.fd);
-               len = strlen(ml.dir) + 9 + 20;
-               archivefilename = xmalloc(len);
-               snprintf(archivefilename, len, "%s/archive/%d", ml.dir,
-                        mindex);
+               xasprintf(&archivefilename, "%s/archive/%d", ml.dir, mindex);
        }
 
        if(!relayhost)