Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc

Issue 1293543006: Make the default directory size returned by stat to be 4096 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
index bb3a8f5ac3524d3370ddc2f6f73b2b4aff2b9f08..12115789ccba7f5a3fc290fa57ab824ef857f82d 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
@@ -169,6 +169,10 @@ Error Html5FsNode::GetStat(struct stat* stat) {
break;
}
stat->st_size = static_cast<off_t>(info.size);
Sam Clegg 2015/08/13 19:08:33 What does info.size mean for html5 fs? Perhaps we
zhitingzhu 2015/08/13 20:56:36 I am not sure about where the info comes from. But
+ // Hack the directory size
+ // In Linux, even a empty directory has size 4096
+ if (info.type == PP_FILETYPE_DIRECTORY && info.size == 0)
+ stat->st_size = 4096;
stat->st_atime = info.last_access_time;
stat->st_mtime = info.last_modified_time;
stat->st_ctime = info.creation_time;
@@ -248,6 +252,9 @@ Error Html5FsNode::GetSize(off_t* out_size) {
return PPERROR_TO_ERRNO(result);
*out_size = info.size;
+ // In Linux, even a empty directory has size 4096
+ if (info.type == PP_FILETYPE_DIRECTORY && info.size == 0)
+ *out_size = 4096;
return 0;
}
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698