Miriam Rubio <mirucam@xxxxxxxxx> writes: > + fp = fopen(path, mode); > + if (!fp) > + return error_errno(_("cannot open file '%s' in mode '%s'"), path, mode); > + res = vfprintf(fp, format, args); > + > + if (res < 0) { > + fclose(fp); > + return error_errno(_("could not write to file '%s'"), path); If the fclose(fp) failed, the errno from that failure (i.e. why fp cannot be closed) would be reported by the error_errno(), which may not be ideal. Either use just error() (which may be suboptimal), follow an often-used pattern to use save_errno (grep for the symbol to learn from the existing code) and keep using error_errno(), or check errors from fclose() too (which may be overkill). if (res < 0) { int saved_errno = errno; #if OVERKILL if (fclose(fp)) error_errno(_("...")); #else fclose(fp); #endif errno = saved_errno; return error_errno(_("..."), ...); }