diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-04-18 17:03:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-04-18 17:03:09 +0300 |
commit | 90bf8adc058142a3ef0653d4d8c765c13356f886 (patch) | |
tree | b9282574a2565363c2a0b83fc2266fb7e0b8e66b /mu | |
parent | 0beec5f21469379685df2553a2a6b0ae5b9449fa (diff) | |
download | mailutils-90bf8adc058142a3ef0653d4d8c765c13356f886.tar.gz mailutils-90bf8adc058142a3ef0653d4d8c765c13356f886.tar.bz2 |
Minor fixes in the mailutils-dbm utility
* mu/libexec/dbm.c (write_quoted_string): Fix expected return
from mu_wordsplit_c_quote_char.
(add_records): Don't break on empty lines.
Diffstat (limited to 'mu')
-rw-r--r-- | mu/libexec/dbm.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mu/libexec/dbm.c b/mu/libexec/dbm.c index 8a213454e..977b7e983 100644 --- a/mu/libexec/dbm.c +++ b/mu/libexec/dbm.c @@ -466,7 +466,7 @@ write_quoted_string (mu_stream_t stream, char *str, size_t len) int c = mu_wordsplit_c_quote_char (*str); mu_stream_write (stream, "\\", 1, NULL); - if (c != -1) + if (c) mu_stream_write (stream, str, 1, NULL); else mu_stream_printf (stream, "%03o", *(unsigned char *) str); @@ -1397,9 +1397,10 @@ add_records (int mode, int replace) /* Read directive header */ ws.ws_delim = ","; - while ((rc = input_getline (&input)) == 0 && - is_dbm_directive (&input) && - !is_len_directive (&input)) + while (!input_eof (&input) + && (rc = input_getline (&input)) == 0 + && is_dbm_directive (&input) + && !is_len_directive (&input)) { size_t i; @@ -1426,7 +1427,7 @@ add_records (int mode, int replace) db = open_db_file (mode); /* Read and store the actual data */ - if (rc == 0 && input_length (&input) > 0) + if (rc == 0 && !input_eof (&input)) { ignore_flagged_directives (DF_HEADER); input_ungetline (&input); |