Peter Wemm <[EMAIL PROTECTED]> writes:
> ===> sbin/swapon
> cc1: warnings being treated as errors
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c: In function `swaplist':
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c:246: warning: field width is not type 
>int (arg 3)
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c:246: warning: field width is not type 
>int (arg 5)
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c:265: warning: field width is not type 
>int (arg 3)
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c:265: warning: field width is not type 
>int (arg 5)
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c:274: warning: field width is not type 
>int (arg 2)
> /home/tinderbox/ia64/src/sbin/swapon/swapon.c:274: warning: field width is not type 
>int (arg 4)
> *** Error code 1

Proposed fix:

%%%
Index: swapon.c
===================================================================
RCS file: /work/repo/src/sbin/swapon/swapon.c,v
retrieving revision 1.14
diff -u -r1.14 swapon.c
--- swapon.c    28 Dec 2002 23:39:47 -0000      1.14
+++ swapon.c    29 Dec 2002 05:53:17 -0000
@@ -53,6 +53,7 @@
 #include <err.h>
 #include <errno.h>
 #include <fstab.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -210,8 +211,8 @@
 {
        size_t mibsize, size;
        struct xswdev xsw;
-       int mib[16], n, pagesize;
-       size_t hlen;
+       int hlen, mib[16], n, pagesize;
+       size_t hsize;
        long blocksize;
        long long total = 0;
        long long used = 0;
@@ -229,7 +230,8 @@
            hlen = 10;
            break;
        default:
-           getbsize(&hlen, &blocksize);
+           getbsize(&hsize, &blocksize);
+           hlen = MIN(INT_MAX, hsize);
            break;
        }
        
%%%

BTW, the tabbing in this area of the source file is messed up.

Best regards,
Mike Barcroft

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to