Mon Mar 16 12:52:32 2009 UTC ()
fix sign-compare issues


(lukem)
diff -r1.52 -r1.53 src/sbin/atactl/atactl.c

cvs diff -r1.52 -r1.53 src/sbin/atactl/atactl.c (expand / switch to unified diff)

--- src/sbin/atactl/atactl.c 2008/08/25 00:45:56 1.52
+++ src/sbin/atactl/atactl.c 2009/03/16 12:52:32 1.53
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atactl.c,v 1.52 2008/08/25 00:45:56 dholland Exp $ */ 1/* $NetBSD: atactl.c,v 1.53 2009/03/16 12:52:32 lukem Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ken Hornstein. 8 * by Ken Hornstein.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * atactl(8) - a program to control ATA devices. 33 * atactl(8) - a program to control ATA devices.
34 */ 34 */
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36 36
37#ifndef lint 37#ifndef lint
38__RCSID("$NetBSD: atactl.c,v 1.52 2008/08/25 00:45:56 dholland Exp $"); 38__RCSID("$NetBSD: atactl.c,v 1.53 2009/03/16 12:52:32 lukem Exp $");
39#endif 39#endif
40 40
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <err.h> 44#include <err.h>
45#include <errno.h> 45#include <errno.h>
46#include <fcntl.h> 46#include <fcntl.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <string.h> 49#include <string.h>
50#include <unistd.h> 50#include <unistd.h>
51#include <util.h> 51#include <util.h>
@@ -673,27 +673,27 @@ print_error(void *buf) @@ -673,27 +673,27 @@ print_error(void *buf)
673 } 673 }
674  674
675 for (i = erlog->mostrecenterror; i < 5; i++) 675 for (i = erlog->mostrecenterror; i < 5; i++)
676 print_error_entry(i, &erlog->log_entries[i]); 676 print_error_entry(i, &erlog->log_entries[i]);
677 for (i = 0; i < erlog->mostrecenterror; i++) 677 for (i = 0; i < erlog->mostrecenterror; i++)
678 print_error_entry(i, &erlog->log_entries[i]); 678 print_error_entry(i, &erlog->log_entries[i]);
679 printf("device error count: %d\n", erlog->device_error_count); 679 printf("device error count: %d\n", erlog->device_error_count);
680} 680}
681 681
682void 682void
683print_selftest_entry(int num, struct ata_smart_selftest *le) 683print_selftest_entry(int num, struct ata_smart_selftest *le)
684{ 684{
685 unsigned char *p; 685 unsigned char *p;
686 int i; 686 size_t i;
687 687
688 /* check if all zero */ 688 /* check if all zero */
689 for (p = (void *)le, i = 0; i < sizeof(*le); i++) 689 for (p = (void *)le, i = 0; i < sizeof(*le); i++)
690 if (p[i] != 0) 690 if (p[i] != 0)
691 break; 691 break;
692 if (i == sizeof(*le)) 692 if (i == sizeof(*le))
693 return; 693 return;
694 694
695 printf("Log entry: %d\n", num); 695 printf("Log entry: %d\n", num);
696 696
697 /* Get test name */ 697 /* Get test name */
698 for (i = 0; selftest_name[i].name != NULL; i++) 698 for (i = 0; selftest_name[i].name != NULL; i++)
699 if (selftest_name[i].number == le->number) 699 if (selftest_name[i].number == le->number)