Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/btdevctl provide more informative error messages



details:   https://anonhg.NetBSD.org/src/rev/183ac101a39e
branches:  trunk
changeset: 763456:183ac101a39e
user:      plunky <plunky%NetBSD.org@localhost>
date:      Sun Mar 20 19:46:13 2011 +0000

description:
provide more informative error messages

diffstat:

 usr.sbin/btdevctl/btdevctl.c |   7 ++-----
 usr.sbin/btdevctl/sdp.c      |  22 +++++++++-------------
 2 files changed, 11 insertions(+), 18 deletions(-)

diffs (80 lines):

diff -r ec69b1a96783 -r 183ac101a39e usr.sbin/btdevctl/btdevctl.c
--- a/usr.sbin/btdevctl/btdevctl.c      Sun Mar 20 17:54:02 2011 +0000
+++ b/usr.sbin/btdevctl/btdevctl.c      Sun Mar 20 19:46:13 2011 +0000
@@ -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;
        }
 
diff -r ec69b1a96783 -r 183ac101a39e usr.sbin/btdevctl/sdp.c
--- a/usr.sbin/btdevctl/sdp.c   Sun Mar 20 17:54:02 2011 +0000
+++ b/usr.sbin/btdevctl/sdp.c   Sun Mar 20 19:46:13 2011 +0000
@@ -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);
-
-                               sdp_close(ss);
+                       if (ss == NULL)
+                               err(EXIT_FAILURE, "SDP connection failed");
 
-                               if (rv == true)
-                                       return dict;
-                       }
+                       if (!cfg_search(ss, i, dict))
+                               errx(EXIT_FAILURE, "service %s not found", service);
 
-                       prop_object_release(dict);
-                       return NULL;
+                       sdp_close(ss);
+                       return dict;
                }
        }
 



Home | Main Index | Thread Index | Old Index