[PATCH v3 1/2] util: Add helper to write() all of a buffer