Re: [PATCH] server-info: avoid calling fclose(3) twice in update_info_file()

2017-04-16 Thread Jeff King
On Sun, Apr 16, 2017 at 06:55:58PM +0200, René Scharfe wrote: > If an error occurs when or after closing the stream we call fclose(3) > again in the error handler. The second call can exhibit undefined > behavior, so make sure to call fclose(3) at most once. Yikes. Good catch. > Also avoid > ca

[PATCH] server-info: avoid calling fclose(3) twice in update_info_file()

2017-04-16 Thread René Scharfe
If an error occurs when or after closing the stream we call fclose(3) again in the error handler. The second call can exhibit undefined behavior, so make sure to call fclose(3) at most once. Also avoid calling close(2) after fd has been successfully associated with the stream, as fclose(3) has be