Skip to content

Commit

Permalink
[usb-moded] Set mode to undefined/disconnected, before re-reading usb…
Browse files Browse the repository at this point in the history
… mode configuration.

Fixes crash when re-loading config data when connected.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Feb 18, 2014
1 parent 747d7c5 commit aff2bd2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/usb_moded.c
Expand Up @@ -603,10 +603,17 @@ static void handle_exit(void)

static void sigint_handler(int signum)
{
struct mode_list_elem *data;

if(signum == SIGINT)
handle_exit();
if(signum == SIGHUP)
{
/* clean up current mode */
data = get_usb_mode_data();
set_disconnected(data);
/* clear existing data to be sure */
set_usb_mode_data(NULL);
/* free and read in modelist again */
free_mode_list(modelist);
modelist = read_mode_list(0);
Expand Down

0 comments on commit aff2bd2

Please sign in to comment.