Merge part of changes from the Haiku project

Hello there,

Here are some fixes to the test suite that were done by the Haiku project. We never upstreamed those, and missed the merge of the testsuite into LTP. Unfortunately, the linux-specific LTP is of little use to us.

I believe these changes are correct. There are a few more I'm not sure about, so I'll ask for further review before submitting them.