[Code-Lint] Fix up void pointer abuses
Make write return 0 (not -1) on failure