clear errno after successful call
When preparing the debian stable backport, I am seeing a call to statvfs() succeed, but also set errno to 2 (ENOENT). Not sure why this happens; I am in a schroot when it does happen, or perhaps stable's libc is a little broken and sets errno incorrectly. Anyway, it should be perfectly fine to clear errno after the successful call, rather than before it.
This commit is contained in:
parent
f089430167
commit
d75771b0ab
1 changed files with 3 additions and 2 deletions
|
@ -58,9 +58,10 @@ unsigned long long int diskfree(const char *path) {
|
|||
unsigned long long int available, blocksize;
|
||||
struct STATSTRUCT buf;
|
||||
|
||||
errno = 0;
|
||||
if (STATCALL(path, &buf) != 0)
|
||||
if (STATCALL(path, &buf) != 0) {
|
||||
return 0; /* errno is set */
|
||||
}
|
||||
errno = 0;
|
||||
|
||||
available = buf.f_bavail;
|
||||
blocksize = buf.f_bsize;
|
||||
|
|
Loading…
Reference in a new issue