diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-04-12 11:34:39 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-04-12 11:34:39 +0000 |
commit | b290889f0265e1278e8a868aa82a65bcc9099b0f (patch) | |
tree | 2fc8dcc3b7f525f61817417e32c2827b57e17b8a /libbb | |
parent | 51742f4bb0c57a4d5063ece9437a2f34a42e52c8 (diff) | |
download | busybox-w32-b290889f0265e1278e8a868aa82a65bcc9099b0f.tar.gz busybox-w32-b290889f0265e1278e8a868aa82a65bcc9099b0f.tar.bz2 busybox-w32-b290889f0265e1278e8a868aa82a65bcc9099b0f.zip |
- add xsendto and use where appropriate; shrink iplink; sanitize libiproute a bit.
-916 byte
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xfuncs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 870d736b3..7fe5c3a45 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -557,6 +557,22 @@ void xlisten(int s, int backlog) | |||
557 | if (listen(s, backlog)) bb_perror_msg_and_die("listen"); | 557 | if (listen(s, backlog)) bb_perror_msg_and_die("listen"); |
558 | } | 558 | } |
559 | 559 | ||
560 | /* Die with an error message if we the sendto failed. | ||
561 | * Return bytes sent otherwise | ||
562 | */ | ||
563 | |||
564 | ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, | ||
565 | socklen_t tolen) | ||
566 | { | ||
567 | ssize_t ret = sendto(s, buf, len, 0, to, tolen); | ||
568 | if (ret < 0) { | ||
569 | if (ENABLE_FEATURE_CLEAN_UP) | ||
570 | close(s); | ||
571 | bb_perror_msg_and_die("sendto"); | ||
572 | } | ||
573 | return ret; | ||
574 | } | ||
575 | |||
560 | // xstat() - a stat() which dies on failure with meaningful error message | 576 | // xstat() - a stat() which dies on failure with meaningful error message |
561 | void xstat(const char *name, struct stat *stat_buf) | 577 | void xstat(const char *name, struct stat *stat_buf) |
562 | { | 578 | { |