Skip to content

Commit

Permalink
Fix some detail, now random mac works fine
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 Jan 18, 2013
1 parent 6243593 commit 522b27d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/usb_moded-mac.c
Expand Up @@ -22,6 +22,7 @@

#include <stdio.h>
#include "usb_moded-mac.h"
#include "usb_moded-log.h"

static void random_ether_addr(unsigned char *addr)
{
Expand All @@ -41,7 +42,7 @@ void generate_random_mac (void)
int i;
FILE *g_ether;

printf("Getting random usb ethernet mac\n");
log_debug("Getting random usb ethernet mac\n");
random_ether_addr(addr);

g_ether = fopen("/etc/modprobe.d/g_ether.conf", "w");
Expand All @@ -51,6 +52,6 @@ void generate_random_mac (void)
{
fprintf(g_ether, "%02x:",addr[i]);
}
fprintf(g_ether, "%02x",addr[i]);
fprintf(g_ether, "%02x\n",addr[i]);
fclose(g_ether);
}
2 changes: 1 addition & 1 deletion src/usb_moded.c
Expand Up @@ -456,7 +456,7 @@ static void usb_moded_init(void)
ctx = kmod_new(NULL, NULL);
kmod_load_resources(ctx);

if(!access("/etc/modprobe.d/g_ether.conf", F_OK))
if(access("/etc/modprobe.d/g_ether.conf", F_OK) != 0)
{
generate_random_mac();
}
Expand Down

0 comments on commit 522b27d

Please sign in to comment.