From 3130cc2014e73ce18dedd545f739b61db90973a5 Mon Sep 17 00:00:00 2001 From: short <> Date: Fri, 22 Aug 2003 00:45:01 +0000 Subject: [PATCH] Use older 2TB-limited 'BLKGETSIZE' if 'BLKGETSIZE64' is not available. --- src/libcaptive/storage/size.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libcaptive/storage/size.c b/src/libcaptive/storage/size.c index 594c624..5348bb9 100644 --- a/src/libcaptive/storage/size.c +++ b/src/libcaptive/storage/size.c @@ -92,16 +92,27 @@ int fd; static guint64 size_ioctl(GIOChannel *iochannel) { -int fd,err; +int fd; guint64 r; +#ifndef BLKGETSIZE64 +long r_long; +#endif g_return_val_if_fail(iochannel!=NULL,0); if (-1==(fd=iounixchannel_get_fd(iochannel))) return 0; - if ((err=ioctl(fd,BLKGETSIZE64,&r))) +#ifdef BLKGETSIZE64 + if (ioctl(fd,BLKGETSIZE64,&r)) + return 0; +#else + if (ioctl(fd,BLKGETSIZE,&r_long)) + return 0; + if (r_long<0) return 0; + r=((guint64)512)*r_long; +#endif return r; } -- 1.8.3.1