[bluez/f20] Default to the XDG cache dir for receiving files
Bastien Nocera
hadess at fedoraproject.org
Tue Nov 12 13:26:59 UTC 2013
commit a338f1b2290c7e4636fcffcbe593ad5f0972f821
Author: Bastien Nocera <hadess at hadess.net>
Date: Tue Nov 12 14:27:16 2013 +0100
Default to the XDG cache dir for receiving files
...ex-Use-user-s-cache-dir-as-a-default-root.patch | 53 ++++++++++++++++++++
bluez.spec | 7 ++-
2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/0001-obex-Use-user-s-cache-dir-as-a-default-root.patch b/0001-obex-Use-user-s-cache-dir-as-a-default-root.patch
new file mode 100644
index 0000000..9cdbd3e
--- /dev/null
+++ b/0001-obex-Use-user-s-cache-dir-as-a-default-root.patch
@@ -0,0 +1,53 @@
+From 841896ae172c08c1652af88d0994f0349912ed14 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess at hadess.net>
+Date: Sun, 10 Nov 2013 15:24:20 +0100
+Subject: [PATCH] obex: Use user's cache dir as a default root
+
+It's per-user, so we won't try to overwrite somebody else's
+files in /tmp when that happens. It's also (unless we have a
+particularly bizarre setup) on the same partition as the destination
+folder which means we can atomically move the file to the destination
+with a unique filename.
+---
+ obexd/src/main.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/obexd/src/main.c b/obexd/src/main.c
+index 61a06b2..80645f8 100644
+--- a/obexd/src/main.c
++++ b/obexd/src/main.c
+@@ -50,8 +50,6 @@
+ #include "obexd.h"
+ #include "server.h"
+
+-#define DEFAULT_ROOT_PATH "/tmp"
+-
+ #define DEFAULT_CAP_FILE CONFIGDIR "/capability.xml"
+
+ static GMainLoop *main_loop = NULL;
+@@ -167,7 +165,7 @@ static GOptionEntry options[] = {
+ "Specify root folder location. Both absolute "
+ "and relative can be used, but relative paths "
+ "are assumed to be relative to user $HOME "
+- "folder", "PATH" },
++ "folder. Default $XDG_CACHE_HOME", "PATH" },
+ { "root-setup", 'S', 0, G_OPTION_ARG_STRING, &option_root_setup,
+ "Root folder setup script", "SCRIPT" },
+ { "symlinks", 'l', 0, G_OPTION_ARG_NONE, &option_symlinks,
+@@ -285,8 +283,11 @@ int main(int argc, char *argv[])
+ exit(EXIT_FAILURE);
+ }
+
+- if (option_root == NULL)
+- option_root = g_strdup(DEFAULT_ROOT_PATH);
++ if (option_root == NULL) {
++ option_root = g_build_filename(g_get_user_cache_dir(), "obexd",
++ NULL);
++ g_mkdir_with_parents(option_root, 0700);
++ }
+
+ if (option_root[0] != '/') {
+ char *old_root = option_root, *home = getenv("HOME");
+--
+1.8.4.2
+
diff --git a/bluez.spec b/bluez.spec
index b36a624..6a5dc5c 100644
--- a/bluez.spec
+++ b/bluez.spec
@@ -3,7 +3,7 @@
Summary: Bluetooth utilities
Name: bluez
Version: 5.10
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.bluez.org/
@@ -17,6 +17,8 @@ Patch1: playstation-peripheral-pugin-v5.x.patch
Patch2: 0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch
# Non-upstream
Patch3: 0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
+# Upstream patch
+Patch4: 0001-obex-Use-user-s-cache-dir-as-a-default-root.patch
BuildRequires: git
BuildRequires: flex
@@ -231,6 +233,9 @@ mkdir -p $RPM_BUILD_ROOT/%{_libdir}/bluetooth/
/lib/udev/rules.d/97-hid2hci.rules
%changelog
+* Tue Nov 12 2013 Bastien Nocera <bnocera at redhat.com> 5.10-3
+- Default to the XDG cache dir for receiving files
+
* Mon Oct 21 2013 Bastien Nocera <bnocera at redhat.com> 5.10-2
- Add non-upstreamable patch to make bluetooth-sendto work again
More information about the scm-commits
mailing list