As David Laight pointed out, there is not much point in calling ferror() unless you call fflush() first.
Unified · Split
| @@ -979,6 +979,7 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) · 978 unmodified lines | ||
| 979 | 979 | |
| 980 | 980 | fprintf(out, "\n$(deps_config): ;\n"); |
| 981 | 981 | |
| 982 | + fflush(out); | |
| 982 | 983 | ret = ferror(out); /* error check for all fprintf() calls */ |
| 983 | 984 | fclose(out); |
| 984 | 985 | if (ret) |
| @@ -1097,6 +1098,7 @@ static int __conf_write_autoconf(const char *filename, · 112 unmodified lines | ||
| 1097 | 1098 | if ((sym->flags & SYMBOL_WRITE) && sym->name) |
| 1098 | 1099 | print_symbol(file, sym); |
| 1099 | 1100 | |
| 1101 | + fflush(file); | |
| 1100 | 1102 | /* check possible errors in conf_write_heading() and print_symbol() */ |
| 1101 | 1103 | ret = ferror(file); |
| 1102 | 1104 | fclose(file); |