Only clear sb.st_size if it is clearly wrong or meaningless. This fixes
mirror mode. PR: bin/86940 MFC after: 2 weeks
This commit is contained in:
parent
ba084f6a80
commit
15e2d64e15
@ -424,17 +424,17 @@ fetch(char *URL, const char *path)
|
||||
r = stat(path, &sb);
|
||||
if (r == 0 && r_flag && S_ISREG(sb.st_mode)) {
|
||||
url->offset = sb.st_size;
|
||||
} else {
|
||||
} else if (r == -1 || !S_ISREG(sb.st_mode)) {
|
||||
/*
|
||||
* Whatever value sb.st_size has now is either
|
||||
* wrong (if stat(2) failed) or irrelevant (if the
|
||||
* path does not refer to a regular file)
|
||||
*/
|
||||
sb.st_size = -1;
|
||||
if (r == -1 && errno != ENOENT) {
|
||||
warnx("%s: stat()", path);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
if (r == -1 && errno != ENOENT) {
|
||||
warnx("%s: stat()", path);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user