> On June 21, 2016, 5:33 p.m., Jiang Yan Xu wrote:
> > 3rdparty/stout/include/stout/os/empty.hpp, line 37
> > <https://reviews.apache.org/r/48314/diff/5/?file=1425826#file1425826line37>
> >
> >     Looks like the Windows version of `readdir` and its internal calls do 
> > set errno 
> > ([exmaple](https://github.com/apache/mesos/blob/56503ea6547c65de7e3e7b294419400894d54003/3rdparty/stout/include/stout/internal/windows/dirent.hpp#L133))
> >  so we don't have to explicitly set things here.
> 
> Jiang Yan Xu wrote:
>     I see. You are right. If there's no error, errno is not guaranteed to be 
> zero unless we set it here.

As discussed with Yan:
As a general pattern, `errno` is set to the actual error within the context of 
system calls when the system call returns failure. However, the system call as 
a rule is not required to set it to 0 on success. Therefore, the pattern is to 
initialize `errno` to 0, and depend on `errno` for the actual error if the 
system call fails. Hence, I think we should keep it as is.


> On June 21, 2016, 5:33 p.m., Jiang Yan Xu wrote:
> > 3rdparty/stout/include/stout/os/empty.hpp, line 42
> > <https://reviews.apache.org/r/48314/diff/5/?file=1425826#file1425826line42>
> >
> >     No need for this.
> 
> Jiang Yan Xu wrote:
>     If the set `errno = 0`, do we still need it here?

Same as previous comment (https://reviews.apache.org/r/48314/#comment204090).


- Anindya


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48314/#review138888
-----------------------------------------------------------


On June 21, 2016, 6:40 p.m., Anindya Sinha wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48314/
> -----------------------------------------------------------
> 
> (Updated June 21, 2016, 6:40 p.m.)
> 
> 
> Review request for mesos, Neil Conway and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5448
>     https://issues.apache.org/jira/browse/MESOS-5448
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added os::empty(path) to check if contents in a directory is empty.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am f10c836c1ac008cc4055741648b5e7dd697e4c1e 
>   3rdparty/stout/include/stout/os.hpp 
> 53b00932693fba7cf6514da6a519269a904de345 
>   3rdparty/stout/include/stout/os/empty.hpp PRE-CREATION 
>   3rdparty/stout/tests/os/rmdir_tests.cpp 
> a11bfc9f9e6cbb05f3e9ce0ea48297b8f88fe53f 
> 
> Diff: https://reviews.apache.org/r/48314/diff/
> 
> 
> Testing
> -------
> 
> All tests passed.
> 
> 
> Thanks,
> 
> Anindya Sinha
> 
>

Reply via email to