aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Kaiser <gkaiser@google.com>2020-03-12 09:00:00 -0700
committerRob Landley <rob@landley.net>2020-03-12 11:57:19 -0500
commit1a2449aa37baf27d61c4232545e90570c42f2e3b (patch)
tree20ce3ffb4e99bd017cf81d43ed57b6b2edfb9036 /lib
parent6888101456b6e1833aca4882670af4c11553a654 (diff)
downloadtoybox-1a2449aa37baf27d61c4232545e90570c42f2e3b.tar.gz
Fix get_block_device_size() for linux
We were incorrectly passing a pointer to a pointer of an unsigned long long, when we just wanted to pass a pointer to the unsigned long long. This is especially bad on 32-bit systems, where we're then writing a 64-bits into a 32-bit value within ioctl. We fix this to pass a pointer to the unsigned long long. Test: On 32-bit device, no longer see native crash from toybox Bug: http://b/151311535 Signed-off-by: Elliott Hughes <enh@google.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/portability.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/portability.c b/lib/portability.c
index 145ac474..26b854d6 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -592,6 +592,6 @@ int get_block_device_size(int fd, unsigned long long* size)
#elif defined(__linux__)
int get_block_device_size(int fd, unsigned long long* size)
{
- return (ioctl(fd, BLKGETSIZE64, &size) >= 0);
+ return (ioctl(fd, BLKGETSIZE64, size) >= 0);
}
#endif