Revision 568bd1bd dumbstreamer.c

View differences:

dumbstreamer.c
15 15
#include "net_helpers.h"
16 16
#include "loop.h"
17 17

  
18
static const char *my_addr = "127.0.0.1";
18
static const char *my_iface = "eth0";
19 19
static int port = 6666;
20 20
static int srv_port;
21 21
static const char *srv_ip = "";
......
49 49
        port =  atoi(optarg);
50 50
        break;
51 51
      case 'I':
52
        my_addr = iface_addr(optarg);
52
        my_iface = strdup(optarg);
53 53
        break;
54 54
      default:
55 55
        fprintf(stderr, "Error: unknown option %c\n", o);
......
62 62
static struct nodeID *init(void)
63 63
{
64 64
  struct nodeID *myID;
65
  char *my_addr = iface_addr(my_iface);
65 66

  
66 67
  myID = create_socket(my_addr, port);
67 68
  if (myID == NULL || getFD(myID) == -1) {
68 69
    fprintf(stderr, "Error creating my socket (%s:%d)!\n", my_addr, port);
70
    free(my_addr);
69 71
    return NULL;
70 72
  }
73
  free(my_addr);
71 74
  topInit(myID);
72 75

  
73 76
  return myID;

Also available in: Unified diff