<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61035>61035</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Cleanup libc time functions wrt their use of errno
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            code-cleanup,
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            rtenneti-google
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sivachandra
      </td>
    </tr>
</table>

<pre>
    This cleanup is to aid with https://discourse.llvm.org/t/rfc-improving-the-hermeticity-of-tests-with-respect-to-errno/68684. Couple of things to be done:

1. Make the helper functions more idiomatic wrt setting `errno`. We do not want to set `errno` in helper functions. The helper functions should instead return `cpp::optional` or `__llvm_libc::ErrorOr` as appropriate.
2. If a standard spec requires that a libc function set `errno` on error, then it should be just before returning from that function.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk0FvpDgQhX-NuZRAYLohOXDIdralPaz2EmmPkTEFrqyx2XKRKP9-5O5OJqPMBQ6Uvnrv8cqkREtAHNTxD6U1C4aAQuUS4-JRaa2Oj4XZxUUeEr0a60yY2BRjnN6HJ0cJrEcT9g0ogUQwNMEbiQMnsiXVPih9Vvo8UbJx54SV969rFXlR-ixKn3m2Ja0bx1cKSykOS4e8opAleS_jXAomSWVGloxpQyulxBKZQ1T63N11d4cKTnHfPEKcQRyF5aJkRJhiwCyhflT17dlU8Lf5D0EcgkO_IcO8BysUQ4I1MgJNFFcjZOGNBRKKUFhAdfV1Z1dX8G9GQ4gCbyZIXpZQvo4AhW_0Cp5-tzO5uPsJKCRBMwGj7Bwyy25b1t4-xC1PGp-5kfOn5-ec4rOn0V5H_mSO_A_nCZPAbBvHjckIVlfXuoK_ZjCQxITJ8AQ5SGD8fyfGBOKMgIHM-1T2zVIMgHmN0qecXgCSD_EjwsueBEacc4JXDzm1meN6pX9gq2Ia2um-vTcFDk3X98dWH3VbuKGru6Y_mHs0vR6Naca5P0zNfKxt1_ezngsadK3bWuteN82xOVTtYaxbbew8jz32LapDjash_9mxglLaceiauj0W3ozo063nNk5Y3pqbS65PSutLntfG85AZ5bgvSR1qT0nST6qQeBxOt95fUhNa8ctPzc0Rh8Swp0stLykWO_vh17tYSNw-VjauSp_zgtur3Di-oM0XcvGQctezjR8BAAD__6kJPeY">