makeing sbin/kld* WARNS=5 clean and some style(9) cleanup
Sebastian Ssmoller
sebastian.ssmoller at web.de
Wed Apr 16 08:47:44 PDT 2003
Hi,
I applied the first patch. Looks good, but kldstat.c seem to be warns=5
clean anyway, doesn't it?
seb
Am Son, 2003-04-13 um 15.34 schrieb Johan Karlsson:
> Hi audit-gang
>
> I intend to commit the attached two patches. The first one makes
> sbin/kld* WARNS=5 clean and marks them as that in the makefiles.
>
> The second patch makes them more style(9) conformant.
> It makes pointer assignment/comparisions use NULL instead of 0.
>
> Any objections?
>
> /Johan K
>
> --
> Johan Karlsson mailto:johan at FreeBSD.org
> ----
>
> Index: sbin/kldconfig/Makefile
> ===================================================================
> RCS file: /home/ncvs/src/sbin/kldconfig/Makefile,v
> retrieving revision 1.2
> diff -u -r1.2 Makefile
> --- sbin/kldconfig/Makefile 4 Dec 2001 02:19:49 -0000 1.2
> +++ sbin/kldconfig/Makefile 13 Apr 2003 12:17:11 -0000
> @@ -28,5 +28,6 @@
>
> PROG= kldconfig
> MAN= kldconfig.8
> +WARNS?= 5
>
> .include <bsd.prog.mk>
> Index: sbin/kldload/Makefile
> ===================================================================
> RCS file: /home/ncvs/src/sbin/kldload/Makefile,v
> retrieving revision 1.9
> diff -u -r1.9 Makefile
> --- sbin/kldload/Makefile 4 Dec 2001 02:19:49 -0000 1.9
> +++ sbin/kldload/Makefile 13 Apr 2003 12:16:50 -0000
> @@ -28,5 +28,6 @@
>
> PROG= kldload
> MAN= kldload.8
> +WARNS?= 5
>
> .include <bsd.prog.mk>
> Index: sbin/kldstat/Makefile
> ===================================================================
> RCS file: /home/ncvs/src/sbin/kldstat/Makefile,v
> retrieving revision 1.8
> diff -u -r1.8 Makefile
> --- sbin/kldstat/Makefile 4 Dec 2001 02:19:49 -0000 1.8
> +++ sbin/kldstat/Makefile 13 Apr 2003 11:30:20 -0000
> @@ -27,7 +27,7 @@
> #
>
> PROG= kldstat
> -WARNS= 0
> MAN= kldstat.8
> +WARNS?= 5
>
> .include <bsd.prog.mk>
> Index: sbin/kldstat/kldstat.c
> ===================================================================
> RCS file: /home/ncvs/src/sbin/kldstat/kldstat.c,v
> retrieving revision 1.9
> diff -u -r1.9 kldstat.c
> --- sbin/kldstat/kldstat.c 1 Jul 2000 07:57:28 -0000 1.9
> +++ sbin/kldstat/kldstat.c 13 Apr 2003 13:12:29 -0000
> @@ -30,6 +30,7 @@
> #endif /* not lint */
>
> #include <err.h>
> +#include <stdint.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> @@ -65,8 +66,9 @@
> if (kldstat(fileid, &stat) < 0)
> warn("can't stat file id %d", fileid);
> else
> - printf("%2d %4d %p %-8x %s\n",
> - stat.id, stat.refs, stat.address, stat.size, stat.name);
> + printf("%2d %4d %p %-8jx %s\n",
> + stat.id, stat.refs, stat.address, (uintmax_t)stat.size,
> + stat.name);
>
> if (verbose) {
> printf("\tContains modules:\n");
> Index: sbin/kldunload/Makefile
> ===================================================================
> RCS file: /home/ncvs/src/sbin/kldunload/Makefile,v
> retrieving revision 1.8
> diff -u -r1.8 Makefile
> --- sbin/kldunload/Makefile 4 Dec 2001 02:19:49 -0000 1.8
> +++ sbin/kldunload/Makefile 13 Apr 2003 11:30:04 -0000
> @@ -27,7 +27,7 @@
> #
>
> PROG= kldunload
> -WARNS= 0
> MAN= kldunload.8
> +WARNS?= 5
>
> .include <bsd.prog.mk>
> Index: sbin/kldunload/kldunload.c
> ===================================================================
> RCS file: /home/ncvs/src/sbin/kldunload/kldunload.c,v
> retrieving revision 1.10
> diff -u -r1.10 kldunload.c
> --- sbin/kldunload/kldunload.c 8 Sep 1999 05:46:47 -0000 1.10
> +++ sbin/kldunload/kldunload.c 13 Apr 2003 13:13:41 -0000
> @@ -76,7 +76,7 @@
> argc--;
> }
>
> - if (argc != 0 || fileid && filename)
> + if (argc != 0 || (fileid && filename))
> usage();
>
> if (fileid == 0 && filename == 0)
> ----
>
> --- sbin/kldconfig/kldconfig.c Sun Apr 13 15:12:57 2003
> +++ sbin/kldconfig/kldconfig.c.new Sun Apr 13 15:13:03 2003
> @@ -142,7 +142,7 @@
> if (sysctl(mib, miblen, NULL, NULL, newpath, strlen(newpath)+1) == -1)
> err(1, "setting path: sysctl(%s)", pathctl);
>
> - if (modpath)
> + if (modpath != NULL)
> free(modpath);
> modpath = newpath;
> }
> --- sbin/kldstat/kldstat.c Sun Apr 13 15:12:29 2003
> +++ sbin/kldstat/kldstat.c.new Sun Apr 13 15:12:40 2003
> @@ -92,7 +92,7 @@
> int c;
> int verbose = 0;
> int fileid = 0;
> - char* filename = 0;
> + char* filename = NULL;
>
> while ((c = getopt(argc, argv, "i:n:v")) != -1)
> switch (c) {
> @@ -114,13 +114,13 @@
> if (argc != 0)
> usage();
>
> - if (filename) {
> + if (filename != NULL) {
> if ((fileid = kldfind(filename)) < 0)
> err(1, "can't find file %s", filename);
> }
>
> printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' ');
> - if (fileid)
> + if (fileid != 0)
> printfile(fileid, verbose);
> else
> for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid))
> --- sbin/kldunload/kldunload.c Sun Apr 13 15:13:41 2003
> +++ sbin/kldunload/kldunload.c.new Sun Apr 13 13:37:19 2003
> @@ -50,7 +50,7 @@
> int c;
> int verbose = 0;
> int fileid = 0;
> - char* filename = 0;
> + char* filename = NULL;
>
> while ((c = getopt(argc, argv, "i:n:v")) != -1)
> switch (c) {
> @@ -71,18 +71,18 @@
> argc -= optind;
> argv += optind;
>
> - if (!fileid && !filename && (argc == 1)) {
> + if (fileid == 0 && filename == NULL && (argc == 1)) {
> filename = *argv;
> argc--;
> }
>
> - if (argc != 0 || (fileid && filename))
> + if (argc != 0 || (fileid != 0 && filename != NULL))
> usage();
>
> - if (fileid == 0 && filename == 0)
> + if (fileid == 0 && filename == NULL)
> usage();
>
> - if (filename) {
> + if (filename != NULL) {
> if ((fileid = kldfind(filename)) < 0)
> err(1, "can't find file %s", filename);
> }
> ----
>
> _______________________________________________
> freebsd-audit at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-audit
> To unsubscribe, send any mail to "freebsd-audit-unsubscribe at freebsd.org"
More information about the freebsd-audit
mailing list