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 ()
else
putchar (c);
}
return 0;
}
......
......@@ -122,11 +122,12 @@ main (int argc, char *argv[])
rc = mu_string_split (argv[++i], ",", list);
if (mu_list_get_iterator (list, &itr) == 0)
{
char *p;
for (mu_iterator_first (itr);
!mu_iterator_is_done (itr); mu_iterator_next (itr))
{
char *p;
mu_iterator_current (itr, (void**)&p);
if (gn >= MU_ARRAY_SIZE (gid))
{
fprintf (stderr, "too many gids\n");
......
......@@ -228,7 +228,7 @@ imap4d_append (struct imap4d_command *command, imap4d_tokbuf_t tok)
if (status == 0)
return io_completion_response (command, RESP_OK, "Completed");
return io_completion_response (command, RESP_NO, err_text);
return io_completion_response (command, RESP_NO, "%s", err_text);
}
......
......@@ -53,7 +53,7 @@ imap4d_close0 (struct imap4d_command *command, imap4d_tokbuf_t tok,
mu_mailbox_destroy (&mbox);
if (msg)
return io_completion_response (command, RESP_NO, msg);
return io_completion_response (command, RESP_NO, "%s", msg);
return io_completion_response (command, RESP_OK, "Completed");
}
......
......@@ -118,5 +118,5 @@ imap4d_create (struct imap4d_command *command, imap4d_tokbuf_t tok)
msg = "already exists";
}
return io_completion_response (command, rc, msg);
return io_completion_response (command, rc, "%s", msg);
}
......
......@@ -75,5 +75,5 @@ imap4d_delete (struct imap4d_command *command, imap4d_tokbuf_t tok)
rc = RESP_NO;
msg = "Cannot remove";
}
return io_completion_response (command, rc, msg);
return io_completion_response (command, rc, "%s", msg);
}
......
......@@ -226,5 +226,5 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok)
free (oldname);
}
free (newname);
return io_completion_response (command, rc, msg);
return io_completion_response (command, rc, "%s", msg);
}
......
......@@ -150,7 +150,7 @@ imap4d_status (struct imap4d_command *command, imap4d_tokbuf_t tok)
return io_completion_response (command, RESP_BAD,
"Too few args (empty list)");
else if (err_msg)
return io_completion_response (command, RESP_BAD, err_msg);
return io_completion_response (command, RESP_BAD, "%s", err_msg);
return io_completion_response (command, RESP_OK, "Completed");
}
......
......@@ -87,7 +87,7 @@ mutil_parse_field_map (const char *map, mu_assoc_t *passoc_tab, int *perr)
{
mu_error (_("cannot split line `%s': %s"), map,
mu_wordsplit_strerror (&ws));
return rc;
return errno;
}
for (i = 0; i < ws.ws_wordc; i++)
......
......@@ -855,12 +855,12 @@ pop_section (struct scan_tree_data *dat)
{ \
unsigned type tmpres; \
const char *s = str; \
int sign; \
int sign; \
unsigned type limit; \
\
if (*s == '-') \
{ \
sign++; \
sign = 1; \
s++; \
limit = TYPE_MINIMUM (type); \
limit = - limit; \
......
......@@ -212,7 +212,7 @@ _streamref_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
return EINVAL;
else
{
mu_off_t *lim;
mu_off_t *lim = arg;
switch (opcode)
{
......
......@@ -412,7 +412,7 @@ mu_wordsplit_dump_nodes (struct mu_wordsplit *wsp)
else
wsp->ws_debug ("%4d: %p: %#04x (%s):%.*s;",
n, p, p->flags, wsnode_flagstr (p->flags),
p->v.segm.end - p->v.segm.beg,
(int)(p->v.segm.end - p->v.segm.beg),
wsp->ws_input + p->v.segm.beg);
}
}
......@@ -773,7 +773,7 @@ expvar (struct mu_wordsplit *wsp, const char *str, size_t len,
else
{
if (wsp->ws_flags & MU_WRDSF_WARNUNDEF)
wsp->ws_error (_("warning: undefined variable `%.*s'"), i, str);
wsp->ws_error (_("warning: undefined variable `%.*s'"), (int) i, str);
if (wsp->ws_flags & MU_WRDSF_KEEPUNDEF)
value = NULL;
else
......@@ -1346,7 +1346,7 @@ mu_wordsplit_len (const char *command, size_t len, struct mu_wordsplit *wsp,
return rc;
if (wsp->ws_flags & MU_WRDSF_SHOWDBG)
wsp->ws_debug ("Input:%.*s;", len, command);
wsp->ws_debug ("Input:%.*s;", (int)len, command);
if (wsp->ws_flags & MU_WRDSF_NOSPLIT)
{
......
......@@ -336,13 +336,13 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from)
char *file;
mu_sieve_value_t *arg;
unsigned int days;
time_t now;
int rc;
mu_stream_t str;
mu_locker_t locker;
if (mu_sieve_tag_lookup (tags, "days", &arg))
{
days = arg->v.number;
if (days > DAYS_MAX)
days = DAYS_MAX;
}
......@@ -402,7 +402,7 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from)
mu_sieve_abort (mach);
}
rc = test_and_update_prop (prop, from, now, days, mach);
rc = test_and_update_prop (prop, from, time (NULL), days, mach);
mu_property_destroy (&prop);
mu_locker_unlock (locker);
mu_locker_destroy (&locker);
......
......@@ -579,7 +579,6 @@ static int
pop_create_pop3_message (struct _pop3_mailbox *mpd, size_t msgno,
struct _pop3_message **mptr)
{
int status;
struct _pop3_message *mpm;
if (msgno > mpd->msg_count)
......@@ -607,7 +606,7 @@ pop_create_pop3_message (struct _pop3_mailbox *mpd, size_t msgno,
mpd->msg[msgno - 1] = mpm;
*mptr = mpm;
return status;
return 0;
}
......
......@@ -311,7 +311,7 @@ static char *default_setup[] = {
static void
do_and_quit (const char *command)
{
int rc = util_do_command (command);
int rc = util_do_command ("%s", command);
mu_mailbox_close (mbox);
exit (rc != 0);
}
......
......@@ -37,7 +37,7 @@ mail_unset (int argc, char **argv)
char *buf = xmalloc ((7+strlen (argv[i])) * sizeof (char));
strcpy (buf, "set no");
strcat (buf, argv[i]);
if (!util_do_command (buf))
if (!util_do_command ("%s", buf))
status = 1;
free (buf);
}
......
......@@ -205,7 +205,7 @@ function : FUNCTION
else
{
yyerror (_("undefined function"));
mu_error ($1);
mu_error ("%s", $1);
YYERROR;
}
}
......
......@@ -158,9 +158,10 @@ mutool_logger (int argc, char **argv)
if (!syslog_tag)
syslog_tag = "mu-logger";
if (mu_stdstream_strerr_create (&logger, logger_type,
syslog_facility, syslog_priority,
syslog_tag, NULL))
rc = mu_stdstream_strerr_create (&logger, logger_type,
syslog_facility, syslog_priority,
syslog_tag, NULL);
if (rc)
{
mu_error (_("cannot create log stream: %s"),
mu_strerror (rc));
......