diff options
author | rsc <devnull@localhost> | 2005-08-10 17:16:38 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-08-10 17:16:38 +0000 |
commit | a3e9d8935f71d308cc879e35cc7f8223996c61ca (patch) | |
tree | d56737f3681bf81428adfd24c4efe2b595ee0507 | |
parent | a32765e337d2657f09630ebf7bd71d9623269546 (diff) | |
download | plan9port-a3e9d8935f71d308cc879e35cc7f8223996c61ca.tar.gz plan9port-a3e9d8935f71d308cc879e35cc7f8223996c61ca.tar.bz2 plan9port-a3e9d8935f71d308cc879e35cc7f8223996c61ca.zip |
Fix overflow in old Linux file size.
-rw-r--r-- | src/lib9/_p9dir.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index e5e9c975..25e6394b 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -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; |