OK, amended this one with a bunch of style fixes from what you suggested: removed one superfluous const (easily deduced by the compiler) and explicitly compared errno to 0.