]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
WIP: Should use rhost?
authorMichael Jeanson <mjeanson@debian.org>
Fri, 1 Mar 2024 19:10:02 +0000 (14:10 -0500)
committerbapt <bapt@noreply.codeberg.org>
Fri, 1 Mar 2024 20:38:00 +0000 (20:38 +0000)
I'm not sure this is the correct fix but the current code tries to
duplicate the string 'relayhost' which is always NULL at this point.

   In file included from send_mail.c:39:
   In function ‘xstrdup’,
       inlined from ‘newsmtp’ at send_mail.c:362:15:
   ../include/xmalloc.h:34:19: warning: argument 1 null where non-null expected [-Wnonnull]
      34 |         char *s = strdup(str);
         |                   ^~~~~~~~~~~
   In file included from ../include/log_error.h:28,
                    from send_mail.c:34:
   /usr/include/string.h: In function ‘newsmtp’:
   /usr/include/string.h:187:14: note: in a call to function ‘strdup’ declared ‘nonnull’
     187 | extern char *strdup (const char *__s)
         |              ^~~~~~

Signed-off-by: Michael Jeanson <mjeanson@debian.org>
src/send_mail.c

index 3196b865be6d182c48c027bbe5d371e2894f03e2..017ebfe8b9a8595470999771e997989c86ba0c23 100644 (file)
@@ -359,7 +359,7 @@ newsmtp(struct ml *ml, const char *rhost)
        unsigned short smtpport = ctrlushort(ml->ctrlfd, "smtpport", 25);
 
        if (rhost != NULL)
-               relayhost = xstrdup(relayhost);
+               relayhost = xstrdup(rhost);
        if (relayhost == NULL)
                relayhost = ctrlvalue(ml->ctrlfd, "relayhost");
        if (relayhost == NULL)