#include <errno.h>
#include <dirent.h>
#include <time.h>
+#include <sys/stat.h>
#include <glib.h>
#include <dbus/dbus.h>
const char *peer)
{
char filename[PATH_MAX];
+ struct stat st;
GKeyFile *key_file;
GError *gerr = NULL;
char *prim_uuid, *str;
char tmp[3];
int i;
- sdp_uuid16_create(&uuid, GATT_PRIM_SVC_UUID);
- prim_uuid = bt_uuid2string(&uuid);
-
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/attributes", local,
peer);
+ /* Check if attributes file exists */
+ if (stat(filename, &st) < 0)
+ return;
+
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,
}
groups = g_key_file_get_groups(key_file, NULL);
+ sdp_uuid16_create(&uuid, GATT_PRIM_SVC_UUID);
+ prim_uuid = bt_uuid2string(&uuid);
+
for (handle = groups; *handle; handle++) {
gboolean uuid_ok;
int end;