chntpw-110511-detect-failure-to-write-key.patch 613 B

1234567891011121314151617181920
  1. diff -ur chntpw-110511.orig/ntreg.c chntpw-110511/ntreg.c
  2. --- chntpw-110511.orig/ntreg.c 2011-05-11 12:33:56.000000000 -0700
  3. +++ chntpw-110511/ntreg.c 2011-11-01 13:45:02.550421729 -0700
  4. @@ -3389,7 +3389,14 @@
  5. fprintf(file,"\r\n"); /* Must end file with an empty line, windows does that */
  6. - fclose(file);
  7. + if (ferror (file)) {
  8. + printf("failed to write file '%s'\n", filename);
  9. + fclose (file);
  10. + return;
  11. + }
  12. + if (fclose(file))
  13. + printf("failed to write file '%s': %s\n", filename,
  14. + strerror(errno));
  15. }
  16. /* ================================================================ */