1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix du counting block devices.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-05-22 16:34:47 +02:00
parent 8d89a6f8ad
commit c81610f7a3

View file

@ -197,7 +197,9 @@ bool disk_usage_file_at(int relfd,
else if ( flag_same_device && st.st_dev != expected_dev ) else if ( flag_same_device && st.st_dev != expected_dev )
return true; return true;
uintmax_t num_bytes = flags & FLAG_APPARENT_SIZE ? uintmax_t num_bytes = S_ISBLK(st.st_mode) ?
0 :
flags & FLAG_APPARENT_SIZE ?
(uintmax_t) st.st_size : (uintmax_t) st.st_size :
st.st_blocks * 512; st.st_blocks * 512;
@ -252,7 +254,7 @@ bool disk_usage_file_at(int relfd,
*num_bytes_ptr = num_bytes; *num_bytes_ptr = num_bytes;
#if defined(__sortix__) #if defined(__sortix__)
if ( derror(dir) ) if ( derror(dir) && errno != ENOTDIR )
{ {
error(0, errno, "reading directory `%s'", path); error(0, errno, "reading directory `%s'", path);
closedir(dir); closedir(dir);