diff options
| author | Paul Donald | 2025-12-02 23:13:14 +0000 |
|---|---|---|
| committer | Robert Marko | 2025-12-03 21:48:31 +0000 |
| commit | a284e7751fa76a0a9a5db3893e8abf335da89aaf (patch) | |
| tree | 488092fa3612dc6fbb390172bcfbde5386b86ed1 | |
| parent | 483263c7b0cd3922b93be2cf9dad5eeccbb9fedb (diff) | |
| download | rpcd-a284e7751fa76a0a9a5db3893e8abf335da89aaf.tar.gz | |
file: bump sz_size to 64 bits
Some systems reveal /proc/kcore which for 64 bit systems has a size of
140,737,471,586,304 bytes.
This is a virtual mapping of the maximum possible RAM in a system. But if a 32
bit value tries to hold this, it is displayed as the erroneous value
-16,769,024 bytes
Bump the size to 64 bits to hold the correct value (and correct values for large
files).
Before this patch:
ubus call file list '{"path":"/proc"}'
...
{
"name": "kcore",
"type": "file",
"size": -16769024,
"mode": 33024,
"atime": 1764716086,
"mtime": 1764716086,
"ctime": 1764716086,
"inode": -268435271,
"uid": 0,
"gid": 0,
},
...
After this patch:
ubus call file list '{"path":"/proc"}'
...
{
"name": "kcore",
"type": "file",
"size": 140737471586304,
"mode": 33024,
"atime": 1764716086,
"mtime": 1764716086,
"ctime": 1764716086,
"inode": -268435271,
"uid": 0,
"gid": 0,
},
...
Tested on: OpenWrt SNAPSHOT r32139-1f879b8839 / 6.12.59
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/rpcd/pull/22
Signed-off-by: Robert Marko <robimarko@gmail.com>
| -rw-r--r-- | file.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -490,7 +490,7 @@ static void _rpc_file_add_stat(struct stat *s) { blobmsg_add_string(&buf, "type", d_types[_get_stat_type(s)]); - blobmsg_add_u32(&buf, "size", s->st_size); + blobmsg_add_u64(&buf, "size", s->st_size); blobmsg_add_u32(&buf, "mode", s->st_mode); blobmsg_add_u32(&buf, "atime", s->st_atime); blobmsg_add_u32(&buf, "mtime", s->st_mtime); |