Description: Detect stream write failure. Forwarded: no --- a/ntreg.c +++ b/ntreg.c @@ -3493,7 +3493,14 @@ fprintf(file,"\r\n"); /* Must end file with an empty line, windows does that */ - fclose(file); + if (ferror (file)) { + printf("failed to write file '%s'\n", filename); + fclose (file); + return; + } + if (fclose(file)) + printf("failed to write file '%s': %s\n", filename, + strerror(errno)); } /* ================================================================ */