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

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