mh,maildir: Minor fix.
* libmailutils/base/amd.c (amd_envelope_date): Remove the trailing newline from the ctime output.
Showing
2 changed files
with
8 additions
and
12 deletions
... | @@ -1885,7 +1885,9 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, | ... | @@ -1885,7 +1885,9 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, |
1885 | mu_message_t msg = mu_envelope_get_owner (envelope); | 1885 | mu_message_t msg = mu_envelope_get_owner (envelope); |
1886 | struct _amd_message *mhm = mu_message_get_owner (msg); | 1886 | struct _amd_message *mhm = mu_message_get_owner (msg); |
1887 | mu_header_t hdr = NULL; | 1887 | mu_header_t hdr = NULL; |
1888 | char *date; | 1888 | const char *date; |
1889 | char datebuf[25]; /* Buffer for the output of ctime (terminating nl being | ||
1890 | replaced by 0) */ | ||
1889 | int status; | 1891 | int status; |
1890 | 1892 | ||
1891 | if (mhm == NULL) | 1893 | if (mhm == NULL) |
... | @@ -1893,8 +1895,8 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, | ... | @@ -1893,8 +1895,8 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, |
1893 | 1895 | ||
1894 | if ((status = mu_message_get_header (msg, &hdr)) != 0) | 1896 | if ((status = mu_message_get_header (msg, &hdr)) != 0) |
1895 | return status; | 1897 | return status; |
1896 | if (mu_header_aget_value (hdr, MU_HEADER_ENV_DATE, &date) | 1898 | if (mu_header_sget_value (hdr, MU_HEADER_ENV_DATE, &date) |
1897 | && mu_header_aget_value (hdr, MU_HEADER_DELIVERY_DATE, &date)) | 1899 | && mu_header_sget_value (hdr, MU_HEADER_DELIVERY_DATE, &date)) |
1898 | return MU_ERR_NOENT; | 1900 | return MU_ERR_NOENT; |
1899 | else | 1901 | else |
1900 | { | 1902 | { |
... | @@ -1903,10 +1905,11 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, | ... | @@ -1903,10 +1905,11 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, |
1903 | 1905 | ||
1904 | /* Convert to ctime format */ | 1906 | /* Convert to ctime format */ |
1905 | rc = mu_parse_date (date, &t, NULL); /* FIXME: TZ info is lost */ | 1907 | rc = mu_parse_date (date, &t, NULL); /* FIXME: TZ info is lost */ |
1906 | free (date); | ||
1907 | if (rc) | 1908 | if (rc) |
1908 | return MU_ERR_NOENT; | 1909 | return MU_ERR_NOENT; |
1909 | date = strdup (ctime (&t)); | 1910 | memcpy (datebuf, ctime (&t), sizeof (datebuf) - 1); |
1911 | datebuf[sizeof (datebuf) - 1] = 0; /* Kill the terminating newline */ | ||
1912 | date = datebuf; | ||
1910 | } | 1913 | } |
1911 | 1914 | ||
1912 | /* Format: "sender date" */ | 1915 | /* Format: "sender date" */ |
... | @@ -1925,8 +1928,6 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, | ... | @@ -1925,8 +1928,6 @@ amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len, |
1925 | else | 1928 | else |
1926 | len = strlen (date); | 1929 | len = strlen (date); |
1927 | 1930 | ||
1928 | free (date); | ||
1929 | |||
1930 | if (psize) | 1931 | if (psize) |
1931 | *psize = len; | 1932 | *psize = len; |
1932 | return 0; | 1933 | return 0; | ... | ... |
... | @@ -32,11 +32,6 @@ | ... | @@ -32,11 +32,6 @@ |
32 | #endif | 32 | #endif |
33 | #include <mailutils/io.h> | 33 | #include <mailutils/io.h> |
34 | 34 | ||
35 | /* | ||
36 | * expands command into its command and arguments, then runs command | ||
37 | * cmd is the command to parse and run | ||
38 | * returns exit status of the command | ||
39 | */ | ||
40 | int | 35 | int |
41 | util_do_command (const char *fmt, ...) | 36 | util_do_command (const char *fmt, ...) |
42 | { | 37 | { | ... | ... |
-
Please register or sign in to post a comment