Revert "Removes some warnings with old gcc compiler."

Not needed as _GNU_SOURCE should be already defined in config.h.
This reverts commit 65cfe677cc8cb65efa71356f40d79d5b796301c0.
Fixes some minor code issues found with coverity scan.