android: fix some problems with libc on android

This adds some small fixes for running on android as the libc sometimes
segfaults due to no obvious reason.
Merge branch 'android' into devel

* android:
  android: fix some problems with libc on android