Mon Mar 16 13:35:37 2009 UTC ()
fix sign-compare issues


(lukem)
diff -r1.6 -r1.7 src/sbin/drvctl/drvctl.c

cvs diff -r1.6 -r1.7 src/sbin/drvctl/drvctl.c (expand / switch to unified diff)

--- src/sbin/drvctl/drvctl.c 2008/01/27 01:38:33 1.6
+++ src/sbin/drvctl/drvctl.c 2009/03/16 13:35:37 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: drvctl.c,v 1.6 2008/01/27 01:38:33 dyoung Exp $ */ 1/* $NetBSD: drvctl.c,v 1.7 2009/03/16 13:35:37 lukem Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004 4 * Copyright (c) 2004
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer. 11 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -139,27 +139,27 @@ main(int argc, char **argv) @@ -139,27 +139,27 @@ main(int argc, char **argv)
139 if (ioctl(fd, DRVLISTDEV, &laa) == -1) 139 if (ioctl(fd, DRVLISTDEV, &laa) == -1)
140 err(3, "DRVLISTDEV"); 140 err(3, "DRVLISTDEV");
141 141
142 children = laa.l_children; 142 children = laa.l_children;
143 143
144 laa.l_childname = malloc(children * sizeof(laa.l_childname[0])); 144 laa.l_childname = malloc(children * sizeof(laa.l_childname[0]));
145 if (laa.l_childname == NULL) 145 if (laa.l_childname == NULL)
146 err(5, "DRVLISTDEV"); 146 err(5, "DRVLISTDEV");
147 if (ioctl(fd, DRVLISTDEV, &laa) == -1) 147 if (ioctl(fd, DRVLISTDEV, &laa) == -1)
148 err(3, "DRVLISTDEV"); 148 err(3, "DRVLISTDEV");
149 if (laa.l_children > children) 149 if (laa.l_children > children)
150 err(6, "DRVLISTDEV: number of children grew"); 150 err(6, "DRVLISTDEV: number of children grew");
151 151
152 for (i = 0; i < laa.l_children; i++) 152 for (i = 0; i < (int)laa.l_children; i++)
153 printf("%s %s\n", laa.l_devname, laa.l_childname[i]); 153 printf("%s %s\n", laa.l_devname, laa.l_childname[i]);
154 break; 154 break;
155 case 'r': 155 case 'r':
156 memset(&raa, 0, sizeof(raa)); 156 memset(&raa, 0, sizeof(raa));
157 strlcpy(raa.busname, argv[0], sizeof(raa.busname)); 157 strlcpy(raa.busname, argv[0], sizeof(raa.busname));
158 if (attr) 158 if (attr)
159 strlcpy(raa.ifattr, attr, sizeof(raa.ifattr)); 159 strlcpy(raa.ifattr, attr, sizeof(raa.ifattr));
160 if (argc > 1) { 160 if (argc > 1) {
161 locs = malloc((argc - 1) * sizeof(int)); 161 locs = malloc((argc - 1) * sizeof(int));
162 if (!locs) 162 if (!locs)
163 err(5, "malloc int[%d]", argc - 1); 163 err(5, "malloc int[%d]", argc - 1);
164 for (i = 0; i < argc - 1; i++) 164 for (i = 0; i < argc - 1; i++)
165 locs[i] = atoi(argv[i + 1]); 165 locs[i] = atoi(argv[i + 1]);