summaryrefslogtreecommitdiff
path: root/server/src/journal_commit.cc
diff options
context:
space:
mode:
authordeva <deva>2008-05-20 14:03:10 +0000
committerdeva <deva>2008-05-20 14:03:10 +0000
commit556f00e4af55e78836c45f47b0662ab44bbb8b48 (patch)
treea5c315b35d400a397a35a86b86fe656d3a829af9 /server/src/journal_commit.cc
parent91d56787bec83a3a7c2ad6afd84d2b82c5d869b9 (diff)
Made fixes pointed out by GCC 4.2 and -D_FORTIFY_SOURCES=2
Diffstat (limited to 'server/src/journal_commit.cc')
-rw-r--r--server/src/journal_commit.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/src/journal_commit.cc b/server/src/journal_commit.cc
index 336ac7a..4b79a65 100644
--- a/server/src/journal_commit.cc
+++ b/server/src/journal_commit.cc
@@ -44,7 +44,7 @@
//#define NO_NETWORK
-static int mwrite(int sock, char *fmt, ...)
+static int mwrite(int sock, const char *fmt, ...)
{
int l = 0;
va_list args;
@@ -56,7 +56,9 @@ static int mwrite(int sock, char *fmt, ...)
l = vsnprintf(buffer, 64*1024, fmt, args);
va_end(args);
- write(sock, buffer, l);
+ if(write(sock, buffer, l) != l) {
+ fprintf(stderr, "write did not write all the bytes in the buffer.\n");
+ }
free(buffer);
@@ -115,7 +117,9 @@ int journal_commit(const char *cpr, const char *user,
mwrite(sock, "\r\n");
// send body
- write(sock, buf, size);
+ if(write(sock, buf, size) != (ssize_t)size) {
+ fprintf(stderr, "write did not write all the bytes in the buffer.\n");
+ }
// close socket
close(sock);