mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Explain why errno is set to 0
This commit is contained in:
parent
f31dfada3e
commit
29fb2b22a2
1 changed files with 7 additions and 1 deletions
|
|
@ -1162,7 +1162,13 @@ static int scan_dir(struct snapraid_scan* scan, int level, int is_diff, const ch
|
|||
struct dirent* dd;
|
||||
size_t name_len;
|
||||
|
||||
/* clear errno to detect erroneous conditions */
|
||||
/*
|
||||
* Clear errno to differentiate the end of the stream and an error condition
|
||||
*
|
||||
* From the Linux readdir() manpage:
|
||||
* "If the end of the directory stream is reached, NULL is returned and errno is not changed.
|
||||
* If an error occurs, NULL is returned and errno is set appropriately."
|
||||
*/
|
||||
errno = 0;
|
||||
dd = readdir(d);
|
||||
if (dd == 0 && errno != 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue