summaryrefslogtreecommitdiffstats
path: root/sys-utils/readprofile.c
diff options
context:
space:
mode:
authorKarel Zak2011-08-01 13:07:32 +0200
committerKarel Zak2011-08-01 13:07:32 +0200
commit33d18dc43571e82b7a052cf28e754349cd1f17ef (patch)
treec4b84c5e67d19af6da27bc6e8aacf4eaaae6c8df /sys-utils/readprofile.c
parentlscpu: fix compiler warnings [-Wsign-compare] (diff)
downloadkernel-qcow2-util-linux-33d18dc43571e82b7a052cf28e754349cd1f17ef.tar.gz
kernel-qcow2-util-linux-33d18dc43571e82b7a052cf28e754349cd1f17ef.tar.xz
kernel-qcow2-util-linux-33d18dc43571e82b7a052cf28e754349cd1f17ef.zip
readprofile: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/readprofile.c')
-rw-r--r--sys-utils/readprofile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 174f9aa0d..0e124bc71 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -122,7 +122,7 @@ main(int argc, char **argv) {
FILE *map;
int proFd;
char *mapFile, *proFile, *mult=0;
- unsigned long len=0, indx=1;
+ size_t len=0, indx=1;
unsigned long long add0=0;
unsigned int step;
unsigned int *buf, total, fn_len;
@@ -130,6 +130,7 @@ main(int argc, char **argv) {
char fn_name[S_LEN], next_name[S_LEN]; /* current and next name */
char mode[8];
int c;
+ ssize_t rc;
int optAll=0, optInfo=0, optReset=0, optVerbose=0, optNative=0;
int optBins=0, optSub=0;
char mapline[S_LEN];
@@ -230,7 +231,8 @@ main(int argc, char **argv) {
buf = xmalloc(len);
- if (read(proFd,buf,len) != len) {
+ rc = read(proFd,buf,len);
+ if (rc < 0 || (size_t) rc != len) {
fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));
exit(1);
}
@@ -238,8 +240,9 @@ main(int argc, char **argv) {
if (!optNative) {
int entries = len/sizeof(*buf);
- int big = 0,small = 0,i;
+ int big = 0,small = 0;
unsigned *p;
+ size_t i;
for (p = buf+1; p < buf+entries; p++) {
if (*p & ~0U << (sizeof(*buf)*4))