summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-15 13:48:39 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-18 16:52:56 -0700
commit5fb27418e7decc30000f57f2f7911dd25c24cb59 (patch)
treef1fa4f30d395ab676f69b42c1717a778b62ecafb /profiles
parent180cf09933b2d8eb03972c8638063429fe5fece5 (diff)
downloadbluez-5fb27418e7decc30000f57f2f7911dd25c24cb59.tar.gz
storage: Add support for STATE_DIRECTORY environment variable
When running as a systemd service the STATE_DIRECTORY environment variable maybe set: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/a2dp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 21b3faa47..6f5b13711 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -40,6 +40,7 @@
#include "src/service.h"
#include "src/log.h"
#include "src/sdpd.h"
+#include "src/textfile.h"
#include "src/shared/queue.h"
#include "src/shared/timeout.h"
#include "src/shared/util.h"
@@ -831,9 +832,10 @@ static void store_remote_seps(struct a2dp_channel *chan)
ba2str(device_get_address(device), dst_addr);
- snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s",
+ create_filename(filename, PATH_MAX, "/%s/cache/%s",
btd_adapter_get_storage_dir(device_get_adapter(device)),
dst_addr);
+
key_file = g_key_file_new();
if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
error("Unable to load key file from %s: (%s)", filename,
@@ -1003,9 +1005,10 @@ static void store_last_used(struct a2dp_channel *chan, uint8_t lseid,
ba2str(device_get_address(chan->device), dst_addr);
- snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s",
+ create_filename(filename, PATH_MAX, "/%s/cache/%s",
btd_adapter_get_storage_dir(device_get_adapter(chan->device)),
dst_addr);
+
key_file = g_key_file_new();
if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
error("Unable to load key file from %s: (%s)", filename,
@@ -2262,9 +2265,10 @@ static void load_remote_seps(struct a2dp_channel *chan)
ba2str(device_get_address(device), dst_addr);
- snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s",
+ create_filename(filename, PATH_MAX, "/%s/cache/%s",
btd_adapter_get_storage_dir(device_get_adapter(device)),
dst_addr);
+
key_file = g_key_file_new();
if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
error("Unable to load key file from %s: (%s)", filename,