diff options
-rw-r--r-- | client.c | 4 | ||||
-rw-r--r-- | server.c | 9 |
2 files changed, 8 insertions, 5 deletions
@@ -19,7 +19,7 @@ #include "utils.h" const char *progname = NULL; -char *port = "1234"; +const char *port = "1234"; static void usage () @@ -43,7 +43,7 @@ send_file (int fd, const char *filename) ssize_t rc; info ("sending `%s'", filename); const char *name = basename ((char *) filename); - size_t filename_len = strlen (name) + 1; + ssize_t filename_len = strlen (name) + 1; rc = write (fd, name, filename_len); /* filename\0payload */ if (rc != filename_len) fatal ("failed to write filename"); @@ -32,7 +32,10 @@ recvfile (int fd) char *filename = NULL; size_t filename_len; off_t filelength = 0; - char *buf = malloc (PATH_MAX); + char *payload_start; + ssize_t rest_len; + + char *buf = (char *) malloc (PATH_MAX); if (!buf) { warning ("failed to allocate space"); @@ -69,8 +72,8 @@ recvfile (int fd) goto clean; } - char *payload_start = buf + filename_len + 1; - ssize_t rest_len = rc - filename_len - 1; + payload_start = buf + filename_len + 1; + rest_len = rc - filename_len - 1; rc = write (dfd, payload_start, rest_len); /* write the rest of buf. */ if (rc != rest_len) { |