summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorKarel Zak2015-01-26 12:12:30 +0100
committerKarel Zak2015-01-26 12:26:00 +0100
commit9bbcf43f882c29ef2003950d8e3d468f05996205 (patch)
tree760c8ee12190881b6fee5fef09ff77831a1f7be8 /disk-utils
parentlibmount: add options map to docs (diff)
downloadkernel-qcow2-util-linux-9bbcf43f882c29ef2003950d8e3d468f05996205.tar.gz
kernel-qcow2-util-linux-9bbcf43f882c29ef2003950d8e3d468f05996205.tar.xz
kernel-qcow2-util-linux-9bbcf43f882c29ef2003950d8e3d468f05996205.zip
libfdisk: don't use off_t in public API
It's better to use exact and explicitly defined types (e.g. uint64_t) rather than something like off_t to make code more portable. [reported with gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3)] The patch also fixes one debug message. Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/fdisk.c6
-rw-r--r--disk-utils/sfdisk.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c
index 6f20a310f..8807940ec 100644
--- a/disk-utils/fdisk.c
+++ b/disk-utils/fdisk.c
@@ -568,7 +568,7 @@ static void dump_buffer(off_t base, unsigned char *buf, size_t sz, int all)
}
static void dump_blkdev(struct fdisk_context *cxt, const char *name,
- off_t offset, size_t size, int all)
+ uint64_t offset, size_t size, int all)
{
int fd = fdisk_get_devfd(cxt);
@@ -577,7 +577,7 @@ static void dump_blkdev(struct fdisk_context *cxt, const char *name,
assert(fd >= 0);
- if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, (off_t) offset, SEEK_SET) == (off_t) -1)
fdisk_warn(cxt, _("cannot seek"));
else {
unsigned char *buf = xmalloc(size);
@@ -604,7 +604,7 @@ void dump_disklabel(struct fdisk_context *cxt)
int all = !isatty(STDOUT_FILENO);
int i = 0;
const char *name = NULL;
- off_t offset = 0;
+ uint64_t offset = 0;
size_t size = 0;
assert(cxt);
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index eed9180ab..f9f733b48 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -225,7 +225,7 @@ static void backup_sectors(struct sfdisk *sf,
const char *tpl,
const char *name,
const char *devname,
- off_t offset, size_t size)
+ uint64_t offset, size_t size)
{
char *fname;
int fd, devfd;
@@ -239,7 +239,7 @@ static void backup_sectors(struct sfdisk *sf,
if (fd < 0)
goto fail;
- if (lseek(devfd, offset, SEEK_SET) == (off_t) -1) {
+ if (lseek(devfd, (off_t) offset, SEEK_SET) == (off_t) -1) {
fdisk_warn(sf->cxt, _("cannot seek %s"), devname);
goto fail;
} else {
@@ -269,7 +269,7 @@ static void backup_partition_table(struct sfdisk *sf, const char *devname)
{
const char *name;
char *tpl;
- off_t offset = 0;
+ uint64_t offset = 0;
size_t size = 0;
int i = 0;