diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 16:18:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 16:18:36 +0000 |
commit | 6c3ea4f47ea280811a7fe53a22f7832e4533c9ec (patch) | |
tree | 3d7ed5da23b5dbf6f9e450dfb61642832249c31e /lib/mail.c | |
parent | Adding upstream version 1:4.13+dfsg1. (diff) | |
download | shadow-6c3ea4f47ea280811a7fe53a22f7832e4533c9ec.tar.xz shadow-6c3ea4f47ea280811a7fe53a22f7832e4533c9ec.zip |
Adding upstream version 1:4.15.2.upstream/1%4.15.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | lib/mail.c (renamed from libmisc/mail.c) | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libmisc/mail.c b/lib/mail.c index 647f879..d14bdb1 100644 --- a/libmisc/mail.c +++ b/lib/mail.c @@ -15,7 +15,9 @@ #include <stdio.h> #include <string.h> +#include "alloc.h" #include "getdef.h" +#include "string/sprintf.h" #ident "$Id$" @@ -34,22 +36,18 @@ void mailcheck (void) */ mailbox = getenv ("MAILDIR"); if (NULL != mailbox) { - char *newmail; - size_t len = strlen (mailbox) + 5; - int wlen; + char *newmail; - newmail = xmalloc (len); - wlen = snprintf (newmail, len, "%s/new", mailbox); - assert (wlen == (int) len - 1); + xasprintf(&newmail, "%s/new", mailbox); if (stat (newmail, &statbuf) != -1 && statbuf.st_size != 0) { if (statbuf.st_mtime > statbuf.st_atime) { - free (newmail); + free(newmail); (void) puts (_("You have new mail.")); return; } } - free (newmail); + free(newmail); } mailbox = getenv ("MAIL"); |