summaryrefslogtreecommitdiffstats
path: root/fdisk/cfdisk.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:18 +0100
committerKarel Zak2006-12-07 00:26:18 +0100
commit2cccd0ff2b26c782dbd05d589b7695cab5e17458 (patch)
tree45ebc5937d2e083c12b58bdeffc1b1a2046c9598 /fdisk/cfdisk.c
parentImported from util-linux-2.12b tarball. (diff)
downloadkernel-qcow2-util-linux-2cccd0ff2b26c782dbd05d589b7695cab5e17458.tar.gz
kernel-qcow2-util-linux-2cccd0ff2b26c782dbd05d589b7695cab5e17458.tar.xz
kernel-qcow2-util-linux-2cccd0ff2b26c782dbd05d589b7695cab5e17458.zip
Imported from util-linux-2.12d tarball.
Diffstat (limited to 'fdisk/cfdisk.c')
-rw-r--r--fdisk/cfdisk.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 9be1c7073..e09b4f5f3 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -170,7 +170,7 @@ int sectors = 0;
long long cylinders = 0;
int cylinder_size = 0; /* heads * sectors */
long long total_size = 0; /* actual_size rounded down */
-long long actual_size = 0; /* set using ioctl */
+long long actual_size = 0; /* (in 512-byte sectors) - set using ioctl */
/* explicitly given user values */
int user_heads = 0, user_sectors = 0;
long long user_cylinders = 0;
@@ -1579,7 +1579,7 @@ static void
fill_p_info(void) {
int pn, i;
long long bs, bsz;
- unsigned long long bytes;
+ unsigned long long llsectors;
struct partition *p;
partition_table buffer;
partition_info tmp_ext = { 0, 0, 0, 0, FREE_SPACE, PRIMARY };
@@ -1608,15 +1608,9 @@ fill_p_info(void) {
ioctl(fd, BLKFLSBUF); /* ignore errors */
/* e.g. Permission Denied */
- if (ioctl(fd, BLKGETSIZE64, &bytes) == 0)
- actual_size = (bytes >> 9);
- else {
- unsigned long sz = 0;
-
- if (ioctl(fd, BLKGETSIZE, &sz))
- fatal(_("Cannot get disk size"), 3);
- actual_size = sz;
- }
+ if (disksize(fd, &llsectors))
+ fatal(_("Cannot get disk size"), 3);
+ actual_size = llsectors;
read_sector(buffer.c.b, 0);