Forking the code from https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/192134