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

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