From 5c0b622f88b8d438fa85f47f45db54b5bdf167c2 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sat, 1 Mar 2008 14:00:33 -0500 Subject: Fix warnings. --- src/mysqlerl.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mysqlerl.c b/src/mysqlerl.c index c9ad653..0f71c52 100644 --- a/src/mysqlerl.c +++ b/src/mysqlerl.c @@ -39,14 +39,14 @@ logmsg(const char *format, ...) va_list args; if (logfile == NULL) - logfile = stderr; + out = stderr; va_start(args, format); - (void)vfprintf(logfile, format, args); - (void)fprintf(logfile, "\n"); + (void)vfprintf(out, format, args); + (void)fprintf(out, "\n"); va_end(args); - fflush(logfile); + fflush(out); } int @@ -135,16 +135,19 @@ write_cmd(const char *cmd, msglen_t len) msglen_t nlen; nlen = htonl(len + 3); - restartable_write((char *)&nlen, sizeof(nlen)); - restartable_write(" - ", 3); - restartable_write(cmd, len); + if (restartable_write((char *)&nlen, sizeof(nlen)) == -1) + return -1; + if (restartable_write(" - ", 3) == -1) + return -1; + if (restartable_write(cmd, len) == -1) + return -1; + + return 0; } void dispatch_db_cmd(MYSQL *dbh, const char *cmd) { - msglen_t len, nlen; - logmsg("DEBUG: dispatch_cmd(\"%s\")", cmd); write_cmd(cmd, strlen(cmd)); } -- cgit v1.2.3