diff options
author | Rob Landley <rob@landley.net> | 2019-01-16 08:58:04 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-01-16 08:58:04 -0600 |
commit | 22927b0b9a75f2d8ccee0210645d690128b87e3e (patch) | |
tree | 5024133e2dd6594758bd9dc896562b8c2d920236 /lib | |
parent | 5c97bb7b4b6bda375e1cc1d5bd09ebf17e003913 (diff) | |
download | toybox-22927b0b9a75f2d8ccee0210645d690128b87e3e.tar.gz |
Move xsendto() to lib/net.c.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.h | 1 | ||||
-rw-r--r-- | lib/net.c | 9 |
2 files changed, 10 insertions, 0 deletions
@@ -310,6 +310,7 @@ int xbind(struct addrinfo *ai); int xpoll(struct pollfd *fds, int nfds, int timeout); int pollinate(int in1, int in2, int out1, int out2, int timeout, int shutdown_timeout); char *ntop(struct sockaddr *sa); +void xsendto(int sockfd, void *buf, size_t len, struct sockaddr *dest); // password.c int get_salt(char *salt, char * algo); @@ -126,3 +126,12 @@ char *ntop(struct sockaddr *sa) return libbuf; } + +void xsendto(int sockfd, void *buf, size_t len, struct sockaddr *dest) +{ + int rc = sendto(sockfd, buf, len, 0, dest, + dest->sa_family == AF_INET ? sizeof(struct sockaddr_in) : + sizeof(struct sockaddr_in6)); + + if (rc != len) perror_exit("sendto"); +} |