diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-12 11:34:39 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-12 11:34:39 +0000 |
commit | f076ed27db62b3dd87789380d366a983a4e12290 (patch) | |
tree | 2fc8dcc3b7f525f61817417e32c2827b57e17b8a /libbb | |
parent | e91ac05530803390f7aa5ca646d90ae26c48aa52 (diff) | |
download | busybox-w32-f076ed27db62b3dd87789380d366a983a4e12290.tar.gz busybox-w32-f076ed27db62b3dd87789380d366a983a4e12290.tar.bz2 busybox-w32-f076ed27db62b3dd87789380d366a983a4e12290.zip |
- add xsendto and use where appropriate; shrink iplink; sanitize libiproute a bit.
-916 byte
git-svn-id: svn://busybox.net/trunk/busybox@18413 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 | { |