aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'FICS/utils.c')
-rw-r--r--FICS/utils.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index 1695926..cbfce51 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -471,19 +471,24 @@ pprintf_prompt(int p, char *format, ...)
warnx("%s: send error", __func__);
}
-PUBLIC int
+PUBLIC void
pprintf_noformat(int p, char *format, ...)
{
- char tmp[10 * MAX_LINE_SIZE];
- int retval;
- va_list ap;
+ char tmp[10 * MAX_LINE_SIZE] = { '\0' };
+ int retval;
+ va_list ap;
va_start(ap, format);
retval = vsnprintf(tmp, sizeof tmp, format, ap);
va_end(ap);
- net_send_string(parray[p].socket, tmp, 0);
- return retval;
+ if (is_too_long(retval, sizeof tmp)) {
+ warnx("%s: error: vsnprintf() truncated", __func__);
+ return;
+ }
+
+ if (net_send_string(parray[p].socket, tmp, 0) == -1)
+ warnx("%s: send error", __func__);
}
PUBLIC int