Skip to content

Commit

Permalink
[usb-moded] Fix mac reading
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 Oct 29, 2013
1 parent a2bf6d7 commit 95ae820
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/usb_moded-mac.c
Expand Up @@ -72,14 +72,16 @@ char * read_mac(void)
FILE *g_ether;
char *mac = NULL, *ret = NULL;
size_t read = 0;
int test = 0;

g_ether = fopen("/etc/modprobe.d/g_ether.conf", "r");
if(!g_ether)
{
log_warning("Failed to read mac address from /etc/modprobe.d/g_ether.conf\n");
return(NULL);
}
if(!fseek(g_ether, 26, SEEK_SET))
test = fseek(g_ether, 26, SEEK_SET);
if(test == -1)
{
fclose(g_ether);
return 0;
Expand All @@ -91,6 +93,7 @@ char * read_mac(void)
ret = strndup(mac,17);
else
ret = 0;

free(mac);
fclose(g_ether);
return(ret);
Expand Down

0 comments on commit 95ae820

Please sign in to comment.