aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2008-03-01 14:00:33 -0500
committerBrian Cully <bjc@kublai.com>2008-03-01 14:00:33 -0500
commit5c0b622f88b8d438fa85f47f45db54b5bdf167c2 (patch)
tree0600b62b1b0f914eecccdcfc693482aa06b728d9
parent06a5f2d1238a60aec81363ec5386548626aaa077 (diff)
downloadmysqlerl-5c0b622f88b8d438fa85f47f45db54b5bdf167c2.tar.gz
mysqlerl-5c0b622f88b8d438fa85f47f45db54b5bdf167c2.zip
Fix warnings.
-rw-r--r--src/mysqlerl.c21
1 files 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));
}