mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
Fix overflow in old Linux file size.
This commit is contained in:
parent
a32765e337
commit
a3e9d8935f
1 changed files with 3 additions and 1 deletions
|
@ -47,6 +47,8 @@ isdisk(struct stat *st)
|
|||
#include <linux/hdreg.h>
|
||||
#include <linux/fs.h>
|
||||
#include <sys/ioctl.h>
|
||||
#undef major
|
||||
#define major(dev) ((int)(((dev) >> 8) & 0xff))
|
||||
static vlong
|
||||
disksize(int fd, int dev)
|
||||
{
|
||||
|
@ -62,7 +64,7 @@ disksize(int fd, int dev)
|
|||
return u64;
|
||||
#endif
|
||||
if(ioctl(fd, BLKGETSIZE, &l) >= 0)
|
||||
return l*512;
|
||||
return (vlong)l*512;
|
||||
if(ioctl(fd, HDIO_GETGEO, &geo) >= 0)
|
||||
return (vlong)geo.heads*geo.sectors*geo.cylinders*512;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue