Module Name: src
Committed By: plunky
Date: Sun Mar 20 19:46:13 UTC 2011
Modified Files:
src/usr.sbin/btdevctl: btdevctl.c sdp.c
Log Message:
provide more informative error messages
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/btdevctl/btdevctl.c \
src/usr.sbin/btdevctl/sdp.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/btdevctl/btdevctl.c
diff -u src/usr.sbin/btdevctl/btdevctl.c:1.8 src/usr.sbin/btdevctl/btdevctl.c:1.9
--- src/usr.sbin/btdevctl/btdevctl.c:1.8 Tue May 12 18:39:20 2009
+++ src/usr.sbin/btdevctl/btdevctl.c Sun Mar 20 19:46:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: btdevctl.c,v 1.8 2009/05/12 18:39:20 plunky Exp $ */
+/* $NetBSD: btdevctl.c,v 1.9 2011/03/20 19:46:13 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -35,7 +35,7 @@
__COPYRIGHT("@(#) Copyright (c) 2006 The NetBSD Foundation, Inc.\
@(#) Copyright (c) 2006 Itronix, Inc.\
All rights reserved.");
-__RCSID("$NetBSD: btdevctl.c,v 1.8 2009/05/12 18:39:20 plunky Exp $");
+__RCSID("$NetBSD: btdevctl.c,v 1.9 2011/03/20 19:46:13 plunky Exp $");
#include <prop/proplib.h>
#include <sys/ioctl.h>
@@ -158,9 +158,6 @@
printf("Performing SDP query for service '%s'..\n", service);
dev = cfg_query(&laddr, &raddr, service);
- if (dev == NULL)
- errx(EXIT_FAILURE, "%s/%s not found", bt_ntoa(&raddr, NULL), service);
-
set = true;
}
Index: src/usr.sbin/btdevctl/sdp.c
diff -u src/usr.sbin/btdevctl/sdp.c:1.8 src/usr.sbin/btdevctl/sdp.c:1.9
--- src/usr.sbin/btdevctl/sdp.c:1.8 Wed Apr 28 06:18:07 2010
+++ src/usr.sbin/btdevctl/sdp.c Sun Mar 20 19:46:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sdp.c,v 1.8 2010/04/28 06:18:07 plunky Exp $ */
+/* $NetBSD: sdp.c,v 1.9 2011/03/20 19:46:13 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: sdp.c,v 1.8 2010/04/28 06:18:07 plunky Exp $");
+__RCSID("$NetBSD: sdp.c,v 1.9 2011/03/20 19:46:13 plunky Exp $");
#include <sys/types.h>
@@ -180,26 +180,22 @@
prop_dictionary_t dict;
sdp_session_t ss;
size_t i;
- bool rv;
dict = prop_dictionary_create();
if (dict == NULL)
- return NULL;
+ err(EXIT_FAILURE, "prop_dictionary_create()");
for (i = 0; i < __arraycount(cfgtype); i++) {
if (strcasecmp(service, cfgtype[i].name) == 0) {
ss = sdp_open(laddr, raddr);
- if (ss != NULL) {
- rv = cfg_search(ss, i, dict);
+ if (ss == NULL)
+ err(EXIT_FAILURE, "SDP connection failed");
- sdp_close(ss);
+ if (!cfg_search(ss, i, dict))
+ errx(EXIT_FAILURE, "service %s not found", service);
- if (rv == true)
- return dict;
- }
-
- prop_object_release(dict);
- return NULL;
+ sdp_close(ss);
+ return dict;
}
}