<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8000001907349px">So as far as I can tell the value of `errno` is undefined in the case that `buffer`, `format`, and `count` are all valid, but `count` is just not big enough (which is really the case we're trying to handle anyway).</span></blockquote><div><br></div><div>Yeah, errno should be 0 only in the case that count is not big enough, which is exactly what I'm checking for. (It's the caller's responsibility to clear errno before calling snprintf). Otherwise, there's an error, and it should be returned as is, and the fprintf wouldn't be necessary.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 27, 2015 at 9:19 AM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yea, I saw that, but it only says that it sets `errno` in the case that `buffer==nullptr` or `count==0` (not sure why it says `count<=0` since `count` is an unsigned type).  So as far as I can tell the value of `errno` is undefined in the case that `buffer`, `format`, and `count` are all valid, but `count` is just not big enough (which is really the case we're trying to handle anyway).<br>
<br>
Even in the case the MSDN doc talks about, you either won't return from the function at all (i.e. it will abort) or it will return `-1`.  So I think it's best to remove the `errno` check.  Otherwise lgtm.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10048&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=MEqT8U_n7oNfuDW5NRbY3ZV384ZquXIYFPWmprwUdKM&m=46nCmP7gYwApmbCvxgMSSUVM5D53MNGXrSgMbjAvRUo&s=eF4omOkseNur85pwVy4euT8xBMyoQ6riMzMCJVJg4oE&e=" target="_blank">http://reviews.llvm.org/D10048</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=MEqT8U_n7oNfuDW5NRbY3ZV384ZquXIYFPWmprwUdKM&m=46nCmP7gYwApmbCvxgMSSUVM5D53MNGXrSgMbjAvRUo&s=gsmKuZKVzthBcMrSNflOzP-psCK6mVCDOTy8EpiCk2U&e=" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>
<br>
</div></div></blockquote></div><br></div>