diag/geodsp: fix ordering of args to fread/fwrite in mk-lba-img
authorH. Peter Anvin <hpa@zytor.com>
Mon, 25 Apr 2011 21:27:28 +0000 (14:27 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 25 Apr 2011 21:27:28 +0000 (14:27 -0700)
If we want the return value to be in bytes, make sure we pass the byte
count in the nmemb field instead of the size field.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diag/geodsp/mk-lba-img.c

index 9de6624..ed5a7ed 100644 (file)
@@ -67,10 +67,10 @@ int main(int argc, char *argv[])
        }
 
        lba = 0;
-       while ((len = fread(b, BPS, 1, stdin))) {
+       while ((len = fread(b, 1, BPS, stdin))) {
                if (len < BPS)
                        memset((char *)b + len, 0, BPS - len);
-               fwrite(b, BPS, 1, f);
+               fwrite(b, 1, BPS, f);
                lba++;
        }
 
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
                        for (i = 0; i < SECT_INT; i++)
                                b[i] = lba;
                }
-               fwrite(b, BPS, 1, f);
+               fwrite(b, 1, BPS, f);
                lba++;
        }