diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-12-18 12:10:04 +0000 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-12-18 12:10:04 +0000 |
commit | 4e222b34c6b359284ac9729bdd8ab7ca0632ae20 (patch) | |
tree | 15490cff925b13ff6d45829eca8040cc24b5f591 /main/musl/1004-define-and-implement-herror.patch | |
parent | e4abece5cdfbd21c39995fec059af885089186e6 (diff) | |
download | aports-4e222b34c6b359284ac9729bdd8ab7ca0632ae20.tar.bz2 aports-4e222b34c6b359284ac9729bdd8ab7ca0632ae20.tar.xz |
main/musl: add patches for tcp socket option structs and herror
Diffstat (limited to 'main/musl/1004-define-and-implement-herror.patch')
-rw-r--r-- | main/musl/1004-define-and-implement-herror.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/main/musl/1004-define-and-implement-herror.patch b/main/musl/1004-define-and-implement-herror.patch new file mode 100644 index 000000000..0935dff6c --- /dev/null +++ b/main/musl/1004-define-and-implement-herror.patch @@ -0,0 +1,55 @@ +From 2a21ef4263d853616df24cc8e4c00f5a2c2980e9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Wed, 18 Dec 2013 13:24:06 +0200 +Subject: [PATCH] define and implement herror + +--- + include/netdb.h | 1 + + src/network/herror.c | 23 +++++++++++++++++++++++ + 2 files changed, 24 insertions(+) + create mode 100644 src/network/herror.c + +diff --git a/include/netdb.h b/include/netdb.h +index 8a7013a..2dd799b 100644 +--- a/include/netdb.h ++++ b/include/netdb.h +@@ -134,6 +134,7 @@ int *__h_errno_location(void); + #endif + + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++void herror(const char *); + const char *hstrerror(int); + int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *); + int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *); +diff --git a/src/network/herror.c b/src/network/herror.c +new file mode 100644 +index 0000000..25117a3 +--- /dev/null ++++ b/src/network/herror.c +@@ -0,0 +1,23 @@ ++#define _GNU_SOURCE ++#include <stdio.h> ++#include <string.h> ++#include <netdb.h> ++#include "stdio_impl.h" ++ ++void herror(const char *msg) ++{ ++ FILE *f = stderr; ++ const char *errstr = hstrerror(h_errno); ++ ++ FLOCK(f); ++ ++ if (msg && *msg) { ++ fwrite(msg, strlen(msg), 1, f); ++ fputc(':', f); ++ fputc(' ', f); ++ } ++ fwrite(errstr, strlen(errstr), 1, f); ++ fputc('\n', f); ++ ++ FUNLOCK(f); ++} +-- +1.8.5.1 + |