Use only rand(), not random().
We used both rand() and random() in our code. Since it returns an int, we have to use %x in our format strings instead of %lx. This fixes a crash under Windows when cross-compiling tinc with a recent version of MinGW.
This commit is contained in:
parent
75773efe26
commit
35e87b903e
4 changed files with 6 additions and 6 deletions
|
@ -45,7 +45,7 @@ bool send_add_edge(connection_t *c, const edge_t *e)
|
|||
|
||||
sockaddr2str(&e->address, &address, &port);
|
||||
|
||||
x = send_request(c, "%d %lx %s %s %s %s %lx %d", ADD_EDGE, random(),
|
||||
x = send_request(c, "%d %x %s %s %s %s %lx %d", ADD_EDGE, rand(),
|
||||
e->from->name, e->to->name, address, port,
|
||||
e->options, e->weight);
|
||||
free(address);
|
||||
|
@ -178,7 +178,7 @@ bool send_del_edge(connection_t *c, const edge_t *e)
|
|||
{
|
||||
cp();
|
||||
|
||||
return send_request(c, "%d %lx %s %s", DEL_EDGE, random(),
|
||||
return send_request(c, "%d %x %s %s", DEL_EDGE, rand(),
|
||||
e->from->name, e->to->name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue