Proper check for `swrite()` return value