summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:14 +0100
committerKarel Zak2006-12-07 00:26:14 +0100
commitd03dd60840f0a08464d5266539ad356aefe24b03 (patch)
tree0a9ad240a7a88eb6b11b152974a7a51a0df79b75 /disk-utils
parentImported from util-linux-2.12pre tarball. (diff)
downloadkernel-qcow2-util-linux-d03dd60840f0a08464d5266539ad356aefe24b03.tar.gz
kernel-qcow2-util-linux-d03dd60840f0a08464d5266539ad356aefe24b03.tar.xz
kernel-qcow2-util-linux-d03dd60840f0a08464d5266539ad356aefe24b03.zip
Imported from util-linux-2.12a tarball.
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/mkswap.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index ee08a445c..d5f2ba0ec 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -63,9 +63,9 @@
static char * program_name = "mkswap";
static char * device_name = NULL;
static int DEV = -1;
-static long PAGES = 0;
+static unsigned long PAGES = 0;
+static unsigned long badpages = 0;
static int check = 0;
-static int badpages = 0;
static int version = -1;
#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
@@ -379,7 +379,7 @@ check_blocks(void) {
if (badpages == 1)
printf(_("one bad page\n"));
else if (badpages > 1)
- printf(_("%d bad pages\n"), badpages);
+ printf(_("%lu bad pages\n"), badpages);
}
static long
@@ -412,10 +412,10 @@ find_size (int fd) {
}
/* return size in pages, to avoid integer overflow */
-static long
+static unsigned long
get_size(const char *file) {
int fd;
- long size;
+ unsigned long size;
fd = open(file, O_RDONLY);
if (fd < 0) {
@@ -440,9 +440,10 @@ isnzdigit(char c) {
int
main(int argc, char ** argv) {
struct stat statbuf;
- int i, sz;
- long maxpages;
- long goodpages;
+ int i;
+ unsigned long maxpages;
+ unsigned long goodpages;
+ unsigned long sz;
off_t offset;
int force = 0;
char *block_count = 0;
@@ -507,7 +508,7 @@ main(int argc, char ** argv) {
explicitly */
char *tmp;
int blocks_per_page = pagesize/1024;
- PAGES = strtol(block_count,&tmp,0)/blocks_per_page;
+ PAGES = strtoul(block_count,&tmp,0)/blocks_per_page;
if (*tmp)
usage();
}
@@ -517,7 +518,7 @@ main(int argc, char ** argv) {
} else if (PAGES > sz && !force) {
fprintf(stderr,
_("%s: error: "
- "size %ld is larger than device size %d\n"),
+ "size %lu is larger than device size %lu\n"),
program_name,
PAGES*(pagesize/1024), sz*(pagesize/1024));
exit(1);
@@ -611,7 +612,7 @@ the -f option to force it.\n"),
}
goodpages = PAGES - badpages - 1;
- if (goodpages <= 0)
+ if ((long) goodpages <= 0)
die(_("Unable to set up swap-space: unreadable"));
printf(_("Setting up swapspace version %d, size = %llu kB\n"),
version, (unsigned long long)goodpages * pagesize / 1000);