Backported a upstream commit (with manually rebased) to fix build with musl 1.2.4. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>