Fix some compiler warnings
warn_unused_result on write() is particularly annoying. You can't just add (void) to ignore it due to gcc bug 66425.
I replaced some of those with fwrite() and used a variable marked with the G_GNUC_UNUSED attribute for the writes from signal handlers.