Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc/dev Correctly match battery types. Old func...
details: https://anonhg.NetBSD.org/src/rev/0fa910977213
branches: trunk
changeset: 580522:0fa910977213
user: briggs <briggs%NetBSD.org@localhost>
date: Wed Apr 27 16:41:54 2005 +0000
description:
Correctly match battery types. Old function would end up matching a
zero-length string. Noted in PR port-macppc/30034 by Magnus Henoch.
Patched as in the PR.
diffstat:
sys/arch/macppc/dev/pm_direct.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (42 lines):
diff -r b669eb1c8323 -r 0fa910977213 sys/arch/macppc/dev/pm_direct.c
--- a/sys/arch/macppc/dev/pm_direct.c Wed Apr 27 16:20:26 2005 +0000
+++ b/sys/arch/macppc/dev/pm_direct.c Wed Apr 27 16:41:54 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pm_direct.c,v 1.25 2005/02/01 03:24:29 briggs Exp $ */
+/* $NetBSD: pm_direct.c,v 1.26 2005/04/27 16:41:54 briggs Exp $ */
/*
* Copyright (C) 1997 Takashi Hamada
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.25 2005/02/01 03:24:29 briggs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.26 2005/04/27 16:41:54 briggs Exp $");
#ifdef DEBUG
#ifndef ADB_DEBUG
@@ -251,16 +251,22 @@
{
}
+/*
+ * Search for targ in list. list is an area of listlen bytes
+ * containing null-terminated strings.
+ */
static int
strinlist(char *targ, char *list, int listlen)
{
char *str;
int sl;
+ int targlen;
str = list;
+ targlen = strlen(targ);
while (listlen > 0) {
sl = strlen(str);
- if (strncmp(targ, str, sl) == 0)
+ if (sl == targlen && (strncmp(targ, str, sl) == 0))
return 1;
str += sl+1;
listlen -= sl+1;
Home |
Main Index |
Thread Index |
Old Index