mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
bugfix: Strdup the generated mac address
This commit is contained in:
parent
32a11dc28d
commit
2d05b6e5e8
1 changed files with 9 additions and 8 deletions
|
@ -241,14 +241,15 @@ const char *DefaultLangRegion() {
|
||||||
|
|
||||||
const char *CreateRandMAC() {
|
const char *CreateRandMAC() {
|
||||||
std::stringstream randStream;
|
std::stringstream randStream;
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
for(int i = 0; i < 6; i++) {
|
for(int i = 0; i < 6; i++) {
|
||||||
randStream << std::hex << (rand() % 256); //generates each octet for the mac in hex format
|
randStream << std::hex << (rand() % 256); //generates each octet for the mac in hex format
|
||||||
if (i<5) {
|
if (i<5) {
|
||||||
randStream << ':'; //we need a : between every octet
|
randStream << ':'; //we need a : between every octet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return randStream.str().c_str(); //no need for creating a new string, just return this
|
// It's ok to strdup, this runs once and will be freed by exiting the process anyway
|
||||||
|
return strdup(randStream.str().c_str()); //no need for creating a new string, just return this
|
||||||
}
|
}
|
||||||
|
|
||||||
static int DefaultNumWorkers() {
|
static int DefaultNumWorkers() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue