nserver

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 615a9c9bdb4c9a93c3eb6354b06533831070eddc
parent 43ea5e861be8ce4914c53cc78a7c4e6c9deec28e
Author: rsiddharth <s@ricketyspace.net>
Date:   Thu, 21 Nov 2019 21:19:11 -0500

nserver: Update nserve.

* nserver/src/nserve.c (nserve): buf -> cmd.

Diffstat:
nserver/src/nserve.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/nserver/src/nserve.c b/nserver/src/nserve.c @@ -46,15 +46,15 @@ int check_cmd_size(char *cmd, int sock) void nserve(int sock) { - size_t buf_sz = 200; - char *buf = calloc(sizeof(char), buf_sz); - check_mem(buf); + size_t cmd_sz = 200; + char *cmd = calloc(sizeof(char), cmd_sz); + check_mem(cmd); // Read command from socket. - ssize_t bytes = slurpsock(buf, buf_sz, sock); + ssize_t bytes = slurpsock(cmd, cmd_sz, sock); check(bytes >= 0, "nserve: slurpsock failed"); - int rc = check_cmd_size(buf, sock); + int rc = check_cmd_size(cmd, sock); check(rc != -1, "command size check failed"); // Quit immediately if cmd size is too large. @@ -63,7 +63,7 @@ void nserve(int sock) } // Write response to socket. - rc = barfsock(buf, bytes, sock); + rc = barfsock(cmd, bytes, sock); check(rc != -1, "nserve: echo failed"); // Close socket. @@ -71,7 +71,7 @@ void nserve(int sock) check(rc == 0, "nserve: close failed"); // Cleanup. - free(buf); + free(cmd); exit(0); error: @@ -79,8 +79,8 @@ void nserve(int sock) check(rc == 0, "nserve: close failed"); // Cleanup if needed. - if (buf) - free(buf); + if (cmd) + free(cmd); exit(1); }