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

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