Skip to content

Commit

Permalink
[usb-moded] Fix diag mode synclist to read files from the right location
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Mar 11, 2014
1 parent bec7713 commit 9de5c83
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/usb_moded-appsync.c
Expand Up @@ -41,7 +41,7 @@
#include "usb_moded-upstart.h"
#include "usb_moded-systemd.h"

static struct list_elem *read_file(const gchar *filename);
static struct list_elem *read_file(const gchar *filename, int diag);
static gboolean enumerate_usb(gpointer data);

static GList *sync_list = NULL;
Expand Down Expand Up @@ -100,7 +100,7 @@ void readlist(int diag)
while( (dirname = g_dir_read_name(confdir)) )
{
log_debug("Read file %s\n", dirname);
if( (list_item = read_file(dirname)) )
if( (list_item = read_file(dirname, diag)) )
sync_list = g_list_append(sync_list, list_item);
}

Expand All @@ -120,14 +120,22 @@ void readlist(int diag)
}
}

static struct list_elem *read_file(const gchar *filename)
static struct list_elem *read_file(const gchar *filename, int diag)
{
gchar *full_filename = NULL;
GKeyFile *settingsfile = NULL;
struct list_elem *list_item = NULL;

if( !(full_filename = g_strconcat(CONF_DIR_PATH, "/", filename, NULL)) )
goto cleanup;
if(diag)
{
if( !(full_filename = g_strconcat(CONF_DIR_DIAG_PATH, "/", filename, NULL)) )
goto cleanup;
}
else
{
if( !(full_filename = g_strconcat(CONF_DIR_PATH, "/", filename, NULL)) )
goto cleanup;
}

if( !(settingsfile = g_key_file_new()) )
goto cleanup;
Expand Down

0 comments on commit 9de5c83

Please sign in to comment.