From a6edc0d38a3009d5f688736006382bd976d073e4 Mon Sep 17 00:00:00 2001 From: rpm-build Date: Dec 09 2020 08:46:56 +0000 Subject: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch patch_name: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch present_in_specfile: true location_in_specfile: 1 --- diff --git a/obexd/src/manager.c b/obexd/src/manager.c index a4af627..c172c59 100644 --- a/obexd/src/manager.c +++ b/obexd/src/manager.c @@ -653,14 +653,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data) DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) { /* Splits folder and name */ - const char *slash = strrchr(name, '/'); + gboolean is_relative = !g_path_is_absolute(name); DBG("Agent replied with %s", name); - if (!slash) { - agent->new_name = g_strdup(name); + if (is_relative) { + agent->new_name = g_path_get_basename(name); agent->new_folder = NULL; } else { - agent->new_name = g_strdup(slash + 1); - agent->new_folder = g_strndup(name, slash - name); + agent->new_name = g_path_get_basename(name); + agent->new_folder = g_path_get_dirname(name); } }