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

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