Module Name:    src
Committed By:   mrg
Date:           Mon May 18 05:51:53 UTC 2009

Modified Files:
        src/usr.sbin/ofctl: ofctl.c

Log Message:
if there is no "name" properly, don't assert(), pretend it is empty.
now "ofctl" works on the shark.  fixes PR#36733.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/ofctl/ofctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/ofctl/ofctl.c
diff -u src/usr.sbin/ofctl/ofctl.c:1.10 src/usr.sbin/ofctl/ofctl.c:1.11
--- src/usr.sbin/ofctl/ofctl.c:1.10	Sun Apr 26 04:54:27 2009
+++ src/usr.sbin/ofctl/ofctl.c	Mon May 18 05:51:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofctl.c,v 1.10 2009/04/26 04:54:27 lukem Exp $	*/
+/*	$NetBSD: ofctl.c,v 1.11 2009/05/18 05:51:53 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2006, 2007\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: ofctl.c,v 1.10 2009/04/26 04:54:27 lukem Exp $");
+__RCSID("$NetBSD: ofctl.c,v 1.11 2009/05/18 05:51:53 mrg Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -564,7 +564,8 @@
 	int len;
 
 	len = OF_getprop(node, "name", name, sizeof(name));
-	assert(len > 0);
+	if (len <= 0)
+		name[0] = '\0';
 	off += snprintf(buf + off, buflen - off, "/%s", name);
 
 	reglen = OF_getprop(node, "reg", reg_buf, sizeof(reg_buf));

Reply via email to