diff options
author | Timo Teräs <timo.teras@iki.fi> | 2017-03-20 15:25:48 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2017-03-21 08:15:29 +0200 |
commit | 1a4d299a0242a02aa0d4843dd9947d4187e70414 (patch) | |
tree | 524965445ca8c9eba7f425db6ffb2035d8025500 /main/musl/0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch | |
parent | c12931e8863fa9fddc90390db24a4a591f43043e (diff) | |
download | aports-1a4d299a0242a02aa0d4843dd9947d4187e70414.tar.bz2 aports-1a4d299a0242a02aa0d4843dd9947d4187e70414.tar.xz |
main/musl: cherry-pick upstream fixes
ldso changes (lazy emulation etc) are not stable yet, so it's
are not included. the missing patch numbers are for those commits.
Diffstat (limited to 'main/musl/0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch')
-rw-r--r-- | main/musl/0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/main/musl/0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch b/main/musl/0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch new file mode 100644 index 0000000000..138bd77f83 --- /dev/null +++ b/main/musl/0021-fix-possible-fd-leak-unrestored-cancellation-state-o.patch @@ -0,0 +1,30 @@ +From 6a209f14ff7273d9429e5153c5b6b1990cb508e3 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Tue, 14 Mar 2017 14:31:34 -0400 +Subject: [PATCH] fix possible fd leak, unrestored cancellation state on dns + socket fail + +--- + src/network/res_msend.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/network/res_msend.c b/src/network/res_msend.c +index de7f6157..3e018009 100644 +--- a/src/network/res_msend.c ++++ b/src/network/res_msend.c +@@ -76,7 +76,11 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries, + fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0); + family = AF_INET; + } +- if (fd < 0 || bind(fd, (void *)&sa, sl) < 0) return -1; ++ if (fd < 0 || bind(fd, (void *)&sa, sl) < 0) { ++ if (fd >= 0) close(fd); ++ pthread_setcancelstate(cs, 0); ++ return -1; ++ } + + /* Past this point, there are no errors. Each individual query will + * yield either no reply (indicated by zero length) or an answer +-- +2.11.1 + |