atd

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/atd
Log | Files | Refs

commit e07587e3c3c55a4bbe8d6a1114c0e58c8e44d1ea
parent 6ce91b5871071c65d9305f5a206c6e14869007e2
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Tue, 25 May 2021 12:04:27 -0500

delete socket on exit

Diffstat:
Matsim.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/atsim.c b/atsim.c @@ -68,7 +68,7 @@ int main() { int ret = read(fds[SOCKFD].fd, fromsock, BUFSIZE); if (ret == -1) { fprintf(stderr, "failed to read from socket\n"); - return 1; + break; } write(STDOUT, fromsock, ret); } @@ -78,7 +78,7 @@ int main() { int ret = write(fds[SOCKFD].fd, tosock, tocount); if (ret == -1) { fprintf(stderr, "failed to read from socket\n"); - return 1; + break; } tocount -= ret; memmove(tosock, tosock + ret, BUFSIZE - ret); @@ -94,7 +94,7 @@ int main() { int ret = read(fds[STDIN].fd, tosock, BUFSIZE); if (ret == -1) { fprintf(stderr, "failed to read from stdin\n"); - return 1; + break; } tocount = ret; tooff = fromsock; @@ -105,5 +105,6 @@ int main() { close(fds[SOCKFD].fd); err: close(sock); + unlink(sockaddr.sun_path); return 1; }