[PATCH] shows error in logs if the special directories are not defined and close the server if failure to start obex server

Alban Browaeys <[email protected]>
Newsgroups gmane.linux.bluez.devel
Message-ID <[email protected]>
This patch is made out of my attempt to start obex-data-server from
debian without xdg-user-dirs . It does not work as the glib special
directories are nto defined but worst than that :
- it did not tell in the log anything went wrong, 
- it did not close the server when it failed to start it and
sharing_enabled and received_enabled where not in sync with the server
state anymore because of that. applet was trying to create the server
while it was already running leading to socket already in use errors
after two attempts. 
This fixes those issues.


Best regards
Alban

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
(unnamed) (text/x-patch, 1.3 KB)
Index: applet/obex.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/obex.c,v
retrieving revision 1.9
diff -u -r1.9 obex.c
--- applet/obex.c	21 Feb 2008 23:46:18 -0000	1.9
+++ applet/obex.c	13 Mar 2008 17:35:20 -0000
@@ -93,10 +93,19 @@
 static void start_opp_notify(DBusGProxy *proxy,
 				DBusGProxyCall *call, void *user_data)
 {
+	GError *error = NULL;
 	opp_startup = FALSE;
 
-	if (dbus_g_proxy_end_call(proxy, call, NULL, G_TYPE_INVALID) == FALSE)
+	if (dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID) == FALSE) {
+		if (error != NULL) {
+			g_printerr("Bluetooth OBEX server start failed: %s\n",
+							error->message);
+			g_error_free(error);
+		}
+
+		close_opp_server();
 		return;
+	}
 
 	receive_enabled = TRUE;
 
@@ -150,10 +159,19 @@
 static void start_ftp_notify(DBusGProxy *proxy,
 				DBusGProxyCall *call, void *user_data)
 {
+	GError * error = NULL;
 	ftp_startup = FALSE;
 
-	if (dbus_g_proxy_end_call(proxy, call, NULL, G_TYPE_INVALID) == FALSE)
+	if (dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID) == FALSE) {
+		if (error != NULL) {
+			g_printerr("Bluetooth FTP server start failed: %s\n",
+							error->message);
+			g_error_free(error);
+		}
+
+		close_ftp_server();
 		return;
+	}
 
 	sharing_enabled = TRUE;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.