This is an archive of the discontinued LLVM Phabricator instance.

Report Windows error code in a fatal error after a system call
ClosedPublic

Authored by probinson on Nov 11 2015, 12:28 PM.

Details

Reviewers
aaron.ballman
Summary

We've had two reports in the past year that CryptAcquireContextW failed; but without the Windows error code it's hard to know what's going on.

Diff Detail

Event Timeline

probinson updated this revision to Diff 39958.Nov 11 2015, 12:28 PM
probinson retitled this revision from to Report Windows error code in a fatal error after a system call.
probinson updated this object.
probinson added a reviewer: aaron.ballman.
probinson added a subscriber: cfe-commits.
bcraig added a subscriber: bcraig.Nov 11 2015, 12:36 PM

Looks good to me, but since this is in the LLVMSupport library, you should probably add llvm-commits to the subscriber list.

aaron.ballman accepted this revision.Nov 11 2015, 12:36 PM
aaron.ballman edited edge metadata.

LGTM with a nit.

Also, I am really curious to know why CryptAcquireContext fails in those cases!

lib/Support/Windows/Process.inc
421

msg should be Msg for style conventions.

This revision is now accepted and ready to land.Nov 11 2015, 12:36 PM
probinson marked an inline comment as done.Nov 11 2015, 12:49 PM

Looks good to me, but since this is in the LLVMSupport library, you should probably add llvm-commits to the subscriber list.

Ah, right, I should have. But I'm not seeing how to add subscribers post-facto.

LGTM with a nit.

Also, I am really curious to know why CryptAcquireContext fails in those cases!

Me too. Once is a fluke, twice is a trend. Probably some obscure system-resource problem but it would be nice to be sure.

lib/Support/Windows/Process.inc
421

The prevailing style in this file is for lowercase parameter names, but I guess we gotta start somewhere!

probinson closed this revision.Nov 11 2015, 12:54 PM
probinson marked an inline comment as done.

r252800, thanks!

Also, I am really curious to know why CryptAcquireContext fails in those cases!

Me too. Once is a fluke, twice is a trend. Probably some obscure system-resource problem but it would be nice to be sure.

I'm out of the office this week, so can't test, but I'm pretty sure you can reproduce this by spawning clang in an environment where the SYSTEMROOT environment variable has not been propagated (or by running it from a cmd window after typing "set SYSTEMROOT=".