Commit dd33613b dd33613b562970a194917f1934aeab56e3cfc4f9 by Sergey Poznyakoff

More bugfixes.

* examples/mblconv.c (main): Return 0.
* examples/murun.c (main): Fix iteration body.
* imap4d/append.c: Do not pass constructed string as format
argument to io_completion_response, use %s instead.
* imap4d/close.c: Likewise.
* imap4d/create.c: Likewise.
* imap4d/delete.c: Likewise.
* imap4d/rename.c: Likewise.
* imap4d/status.c: Likewise.
* libmailutils/base/mutil.c (mutil_parse_field_map): Fix return
code in case of wordsplit failure.
* libmailutils/cfg/parser.y (GETSNUM): Initialize sign.
* libmailutils/stream/streamref.c (_streamref_ctl)
<MU_IOCTL_SEEK_LIMITS>: Initialize lim.
* libmailutils/string/wordsplit.c: Typecast format width arguments
to int.
* libmu_sieve/extensions/vacation.c (check_db): Initialize days.
Pass correct time value to test_and_update_prop.
* libproto/pop/mbox.c (pop_create_pop3_message): Fix return code.
* mail/mail.c (do_and_quit): Pass the command to util_do_command
via the %s format.
* mail/unset.c (mail_unset): Likewise.
* mh/mh_fmtgram.y (function production): LIkewise for mu_error.
* mu/logger.c (mutool_logger): Fix return code in case
of mu_stdstream_strerr_create failure.
1 parent 02634d3b
...@@ -34,4 +34,5 @@ main () ...@@ -34,4 +34,5 @@ main ()
34 else 34 else
35 putchar (c); 35 putchar (c);
36 } 36 }
37 return 0;
37 } 38 }
......
...@@ -122,11 +122,12 @@ main (int argc, char *argv[]) ...@@ -122,11 +122,12 @@ main (int argc, char *argv[])
122 rc = mu_string_split (argv[++i], ",", list); 122 rc = mu_string_split (argv[++i], ",", list);
123 if (mu_list_get_iterator (list, &itr) == 0) 123 if (mu_list_get_iterator (list, &itr) == 0)
124 { 124 {
125 char *p;
126
127 for (mu_iterator_first (itr); 125 for (mu_iterator_first (itr);
128 !mu_iterator_is_done (itr); mu_iterator_next (itr)) 126 !mu_iterator_is_done (itr); mu_iterator_next (itr))
129 { 127 {
128 char *p;
129
130 mu_iterator_current (itr, (void**)&p);
130 if (gn >= MU_ARRAY_SIZE (gid)) 131 if (gn >= MU_ARRAY_SIZE (gid))
131 { 132 {
132 fprintf (stderr, "too many gids\n"); 133 fprintf (stderr, "too many gids\n");
......
...@@ -228,7 +228,7 @@ imap4d_append (struct imap4d_command *command, imap4d_tokbuf_t tok) ...@@ -228,7 +228,7 @@ imap4d_append (struct imap4d_command *command, imap4d_tokbuf_t tok)
228 if (status == 0) 228 if (status == 0)
229 return io_completion_response (command, RESP_OK, "Completed"); 229 return io_completion_response (command, RESP_OK, "Completed");
230 230
231 return io_completion_response (command, RESP_NO, err_text); 231 return io_completion_response (command, RESP_NO, "%s", err_text);
232 } 232 }
233 233
234 234
......
...@@ -53,7 +53,7 @@ imap4d_close0 (struct imap4d_command *command, imap4d_tokbuf_t tok, ...@@ -53,7 +53,7 @@ imap4d_close0 (struct imap4d_command *command, imap4d_tokbuf_t tok,
53 mu_mailbox_destroy (&mbox); 53 mu_mailbox_destroy (&mbox);
54 54
55 if (msg) 55 if (msg)
56 return io_completion_response (command, RESP_NO, msg); 56 return io_completion_response (command, RESP_NO, "%s", msg);
57 return io_completion_response (command, RESP_OK, "Completed"); 57 return io_completion_response (command, RESP_OK, "Completed");
58 } 58 }
59 59
......
...@@ -118,5 +118,5 @@ imap4d_create (struct imap4d_command *command, imap4d_tokbuf_t tok) ...@@ -118,5 +118,5 @@ imap4d_create (struct imap4d_command *command, imap4d_tokbuf_t tok)
118 msg = "already exists"; 118 msg = "already exists";
119 } 119 }
120 120
121 return io_completion_response (command, rc, msg); 121 return io_completion_response (command, rc, "%s", msg);
122 } 122 }
......
...@@ -75,5 +75,5 @@ imap4d_delete (struct imap4d_command *command, imap4d_tokbuf_t tok) ...@@ -75,5 +75,5 @@ imap4d_delete (struct imap4d_command *command, imap4d_tokbuf_t tok)
75 rc = RESP_NO; 75 rc = RESP_NO;
76 msg = "Cannot remove"; 76 msg = "Cannot remove";
77 } 77 }
78 return io_completion_response (command, rc, msg); 78 return io_completion_response (command, rc, "%s", msg);
79 } 79 }
......
...@@ -226,5 +226,5 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok) ...@@ -226,5 +226,5 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok)
226 free (oldname); 226 free (oldname);
227 } 227 }
228 free (newname); 228 free (newname);
229 return io_completion_response (command, rc, msg); 229 return io_completion_response (command, rc, "%s", msg);
230 } 230 }
......
...@@ -150,7 +150,7 @@ imap4d_status (struct imap4d_command *command, imap4d_tokbuf_t tok) ...@@ -150,7 +150,7 @@ imap4d_status (struct imap4d_command *command, imap4d_tokbuf_t tok)
150 return io_completion_response (command, RESP_BAD, 150 return io_completion_response (command, RESP_BAD,
151 "Too few args (empty list)"); 151 "Too few args (empty list)");
152 else if (err_msg) 152 else if (err_msg)
153 return io_completion_response (command, RESP_BAD, err_msg); 153 return io_completion_response (command, RESP_BAD, "%s", err_msg);
154 return io_completion_response (command, RESP_OK, "Completed"); 154 return io_completion_response (command, RESP_OK, "Completed");
155 } 155 }
156 156
......
...@@ -87,7 +87,7 @@ mutil_parse_field_map (const char *map, mu_assoc_t *passoc_tab, int *perr) ...@@ -87,7 +87,7 @@ mutil_parse_field_map (const char *map, mu_assoc_t *passoc_tab, int *perr)
87 { 87 {
88 mu_error (_("cannot split line `%s': %s"), map, 88 mu_error (_("cannot split line `%s': %s"), map,
89 mu_wordsplit_strerror (&ws)); 89 mu_wordsplit_strerror (&ws));
90 return rc; 90 return errno;
91 } 91 }
92 92
93 for (i = 0; i < ws.ws_wordc; i++) 93 for (i = 0; i < ws.ws_wordc; i++)
......
...@@ -855,12 +855,12 @@ pop_section (struct scan_tree_data *dat) ...@@ -855,12 +855,12 @@ pop_section (struct scan_tree_data *dat)
855 { \ 855 { \
856 unsigned type tmpres; \ 856 unsigned type tmpres; \
857 const char *s = str; \ 857 const char *s = str; \
858 int sign; \ 858 int sign; \
859 unsigned type limit; \ 859 unsigned type limit; \
860 \ 860 \
861 if (*s == '-') \ 861 if (*s == '-') \
862 { \ 862 { \
863 sign++; \ 863 sign = 1; \
864 s++; \ 864 s++; \
865 limit = TYPE_MINIMUM (type); \ 865 limit = TYPE_MINIMUM (type); \
866 limit = - limit; \ 866 limit = - limit; \
......
...@@ -212,7 +212,7 @@ _streamref_ctl (struct _mu_stream *str, int code, int opcode, void *arg) ...@@ -212,7 +212,7 @@ _streamref_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
212 return EINVAL; 212 return EINVAL;
213 else 213 else
214 { 214 {
215 mu_off_t *lim; 215 mu_off_t *lim = arg;
216 216
217 switch (opcode) 217 switch (opcode)
218 { 218 {
......
...@@ -412,7 +412,7 @@ mu_wordsplit_dump_nodes (struct mu_wordsplit *wsp) ...@@ -412,7 +412,7 @@ mu_wordsplit_dump_nodes (struct mu_wordsplit *wsp)
412 else 412 else
413 wsp->ws_debug ("%4d: %p: %#04x (%s):%.*s;", 413 wsp->ws_debug ("%4d: %p: %#04x (%s):%.*s;",
414 n, p, p->flags, wsnode_flagstr (p->flags), 414 n, p, p->flags, wsnode_flagstr (p->flags),
415 p->v.segm.end - p->v.segm.beg, 415 (int)(p->v.segm.end - p->v.segm.beg),
416 wsp->ws_input + p->v.segm.beg); 416 wsp->ws_input + p->v.segm.beg);
417 } 417 }
418 } 418 }
...@@ -773,7 +773,7 @@ expvar (struct mu_wordsplit *wsp, const char *str, size_t len, ...@@ -773,7 +773,7 @@ expvar (struct mu_wordsplit *wsp, const char *str, size_t len,
773 else 773 else
774 { 774 {
775 if (wsp->ws_flags & MU_WRDSF_WARNUNDEF) 775 if (wsp->ws_flags & MU_WRDSF_WARNUNDEF)
776 wsp->ws_error (_("warning: undefined variable `%.*s'"), i, str); 776 wsp->ws_error (_("warning: undefined variable `%.*s'"), (int) i, str);
777 if (wsp->ws_flags & MU_WRDSF_KEEPUNDEF) 777 if (wsp->ws_flags & MU_WRDSF_KEEPUNDEF)
778 value = NULL; 778 value = NULL;
779 else 779 else
...@@ -1346,7 +1346,7 @@ mu_wordsplit_len (const char *command, size_t len, struct mu_wordsplit *wsp, ...@@ -1346,7 +1346,7 @@ mu_wordsplit_len (const char *command, size_t len, struct mu_wordsplit *wsp,
1346 return rc; 1346 return rc;
1347 1347
1348 if (wsp->ws_flags & MU_WRDSF_SHOWDBG) 1348 if (wsp->ws_flags & MU_WRDSF_SHOWDBG)
1349 wsp->ws_debug ("Input:%.*s;", len, command); 1349 wsp->ws_debug ("Input:%.*s;", (int)len, command);
1350 1350
1351 if (wsp->ws_flags & MU_WRDSF_NOSPLIT) 1351 if (wsp->ws_flags & MU_WRDSF_NOSPLIT)
1352 { 1352 {
......
...@@ -336,13 +336,13 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from) ...@@ -336,13 +336,13 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from)
336 char *file; 336 char *file;
337 mu_sieve_value_t *arg; 337 mu_sieve_value_t *arg;
338 unsigned int days; 338 unsigned int days;
339 time_t now;
340 int rc; 339 int rc;
341 mu_stream_t str; 340 mu_stream_t str;
342 mu_locker_t locker; 341 mu_locker_t locker;
343 342
344 if (mu_sieve_tag_lookup (tags, "days", &arg)) 343 if (mu_sieve_tag_lookup (tags, "days", &arg))
345 { 344 {
345 days = arg->v.number;
346 if (days > DAYS_MAX) 346 if (days > DAYS_MAX)
347 days = DAYS_MAX; 347 days = DAYS_MAX;
348 } 348 }
...@@ -402,7 +402,7 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from) ...@@ -402,7 +402,7 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from)
402 mu_sieve_abort (mach); 402 mu_sieve_abort (mach);
403 } 403 }
404 404
405 rc = test_and_update_prop (prop, from, now, days, mach); 405 rc = test_and_update_prop (prop, from, time (NULL), days, mach);
406 mu_property_destroy (&prop); 406 mu_property_destroy (&prop);
407 mu_locker_unlock (locker); 407 mu_locker_unlock (locker);
408 mu_locker_destroy (&locker); 408 mu_locker_destroy (&locker);
......
...@@ -579,7 +579,6 @@ static int ...@@ -579,7 +579,6 @@ static int
579 pop_create_pop3_message (struct _pop3_mailbox *mpd, size_t msgno, 579 pop_create_pop3_message (struct _pop3_mailbox *mpd, size_t msgno,
580 struct _pop3_message **mptr) 580 struct _pop3_message **mptr)
581 { 581 {
582 int status;
583 struct _pop3_message *mpm; 582 struct _pop3_message *mpm;
584 583
585 if (msgno > mpd->msg_count) 584 if (msgno > mpd->msg_count)
...@@ -607,7 +606,7 @@ pop_create_pop3_message (struct _pop3_mailbox *mpd, size_t msgno, ...@@ -607,7 +606,7 @@ pop_create_pop3_message (struct _pop3_mailbox *mpd, size_t msgno,
607 606
608 mpd->msg[msgno - 1] = mpm; 607 mpd->msg[msgno - 1] = mpm;
609 *mptr = mpm; 608 *mptr = mpm;
610 return status; 609 return 0;
611 } 610 }
612 611
613 612
......
...@@ -311,7 +311,7 @@ static char *default_setup[] = { ...@@ -311,7 +311,7 @@ static char *default_setup[] = {
311 static void 311 static void
312 do_and_quit (const char *command) 312 do_and_quit (const char *command)
313 { 313 {
314 int rc = util_do_command (command); 314 int rc = util_do_command ("%s", command);
315 mu_mailbox_close (mbox); 315 mu_mailbox_close (mbox);
316 exit (rc != 0); 316 exit (rc != 0);
317 } 317 }
......
...@@ -37,7 +37,7 @@ mail_unset (int argc, char **argv) ...@@ -37,7 +37,7 @@ mail_unset (int argc, char **argv)
37 char *buf = xmalloc ((7+strlen (argv[i])) * sizeof (char)); 37 char *buf = xmalloc ((7+strlen (argv[i])) * sizeof (char));
38 strcpy (buf, "set no"); 38 strcpy (buf, "set no");
39 strcat (buf, argv[i]); 39 strcat (buf, argv[i]);
40 if (!util_do_command (buf)) 40 if (!util_do_command ("%s", buf))
41 status = 1; 41 status = 1;
42 free (buf); 42 free (buf);
43 } 43 }
......
...@@ -205,7 +205,7 @@ function : FUNCTION ...@@ -205,7 +205,7 @@ function : FUNCTION
205 else 205 else
206 { 206 {
207 yyerror (_("undefined function")); 207 yyerror (_("undefined function"));
208 mu_error ($1); 208 mu_error ("%s", $1);
209 YYERROR; 209 YYERROR;
210 } 210 }
211 } 211 }
......
...@@ -158,9 +158,10 @@ mutool_logger (int argc, char **argv) ...@@ -158,9 +158,10 @@ mutool_logger (int argc, char **argv)
158 158
159 if (!syslog_tag) 159 if (!syslog_tag)
160 syslog_tag = "mu-logger"; 160 syslog_tag = "mu-logger";
161 if (mu_stdstream_strerr_create (&logger, logger_type, 161 rc = mu_stdstream_strerr_create (&logger, logger_type,
162 syslog_facility, syslog_priority, 162 syslog_facility, syslog_priority,
163 syslog_tag, NULL)) 163 syslog_tag, NULL);
164 if (rc)
164 { 165 {
165 mu_error (_("cannot create log stream: %s"), 166 mu_error (_("cannot create log stream: %s"),
166 mu_strerror (rc)); 167 mu_strerror (rc));
......