Blame SOURCES/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch

2b7b48
From f7861d27fbcbc519f57d8496aa9486f487908821 Mon Sep 17 00:00:00 2001
2b7b48
From: Bastien Nocera <hadess@hadess.net>
2b7b48
Date: Sat, 9 Nov 2013 18:13:43 +0100
2b7b48
Subject: [PATCH 1/5] obex: Use GLib helper function to manipulate paths
2b7b48
2b7b48
Instead of trying to do it by hand. This also makes sure that
2b7b48
relative paths aren't used by the agent.
2b7b48
---
2b7b48
 obexd/src/manager.c | 10 +++++-----
2b7b48
 1 file changed, 5 insertions(+), 5 deletions(-)
2b7b48
2b7b48
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
2b7b48
index cec8a39..f18896e 100644
2b7b48
--- a/obexd/src/manager.c
2b7b48
+++ b/obexd/src/manager.c
2b7b48
@@ -651,14 +651,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data)
2b7b48
 				DBUS_TYPE_STRING, &name,
2b7b48
 				DBUS_TYPE_INVALID)) {
2b7b48
 		/* Splits folder and name */
2b7b48
-		const char *slash = strrchr(name, '/');
2b7b48
+		gboolean is_relative = !g_path_is_absolute(name);
2b7b48
 		DBG("Agent replied with %s", name);
2b7b48
-		if (!slash) {
2b7b48
-			agent->new_name = g_strdup(name);
2b7b48
+		if (is_relative) {
2b7b48
+			agent->new_name = g_path_get_basename(name);
2b7b48
 			agent->new_folder = NULL;
2b7b48
 		} else {
2b7b48
-			agent->new_name = g_strdup(slash + 1);
2b7b48
-			agent->new_folder = g_strndup(name, slash - name);
2b7b48
+			agent->new_name = g_path_get_basename(name);
2b7b48
+			agent->new_folder = g_path_get_dirname(name);
2b7b48
 		}
2b7b48
 	}
2b7b48
 
2b7b48
-- 
2b7b48
1.8.4.2
2b7b48