public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Magdalena Trivina Sihotang <trivin2024@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Magdalena Trivina <trivin2024@gmail.com>
Subject: [PATCH] tools/sdptool: report error when local SDP server is not found
Date: Thu, 29 Jan 2026 00:39:05 +0900	[thread overview]
Message-ID: <20260128153905.163137-1-trivin2024@gmail.com> (raw)

From: Magdalena Trivina <trivin2024@gmail.com>

Currently, the sdptool add, setattr and setseq commands do not
report any error when the local SDP server is unavailable.

Add an explicit error message so users can distinguish between
successful execution and failure due to a missing local server.

Signed-off-by: Magdalena Trivina Sihotang <trivin2024@gmail.com>
---
 tools/sdptool.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/sdptool.c b/tools/sdptool.c
index 4e95a18d0..4f4dd41ac 100644
--- a/tools/sdptool.c
+++ b/tools/sdptool.c
@@ -871,8 +871,10 @@ static int cmd_setattr(int argc, char **argv)
 
 	/* Do it */
 	sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
-	if (!sess)
+	if (!sess) {
+		printf("No local SDP server!\n");
 		return -1;
+	}
 
 	status = set_attrib(sess, handle, attrib, argv[2]);
 	sdp_close(sess);
@@ -1033,8 +1035,10 @@ static int cmd_setseq(int argc, char **argv)
 
 	/* Do it */
 	sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
-	if (!sess)
+	if (!sess) {
+		printf("No local SDP server!\n");
 		return -1;
+	}
 
 	status = set_attribseq(sess, handle, attrib, argc, argv);
 	sdp_close(sess);
@@ -3692,8 +3696,10 @@ static int add_service(bdaddr_t *bdaddr, svc_info_t *si)
 		return -1;
 
 	sess = sdp_connect(&interface, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
-	if (!sess)
+	if (!sess) {
+		printf("No local SDP server!\n");
 		return -1;
+	}
 
 	for (i = 0; service[i].name; i++)
 		if (!strcasecmp(service[i].name, si->name)) {
-- 
2.34.1


             reply	other threads:[~2026-01-28 15:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 15:39 Magdalena Trivina Sihotang [this message]
2026-01-28 16:47 ` tools/sdptool: report error when local SDP server is not found bluez.test.bot
2026-01-28 17:28 ` [PATCH] " Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260128153905.163137-1-trivin2024@gmail.com \
    --to=trivin2024@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox