mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-07-12 18:03:50 +00:00
libgamestream: fix uniqueid.dat read check
fread(unique_id, UNIQUEID_CHARS, 1, fd) returns the number of items read (1 on success), not bytes, so the != UNIQUEID_CHARS comparison is always true. Any existing uniqueid.dat is silently ignored and rewritten with the default 0123456789ABCDEF on every run, making a custom per-device uniqueid impossible.
This commit is contained in:
committed by
Cameron Gutman
parent
f7dc33c870
commit
f32e415aea
@@ -92,7 +92,7 @@ static int load_unique_id(const char* keyDirectory) {
|
||||
snprintf(uniqueFilePath, PATH_MAX, "%s/%s", keyDirectory, UNIQUE_FILE_NAME);
|
||||
|
||||
FILE *fd = fopen(uniqueFilePath, "r");
|
||||
if (fd == NULL || fread(unique_id, UNIQUEID_CHARS, 1, fd) != UNIQUEID_CHARS) {
|
||||
if (fd == NULL || fread(unique_id, UNIQUEID_CHARS, 1, fd) != 1) {
|
||||
snprintf(unique_id,UNIQUEID_CHARS+1,"0123456789ABCDEF");
|
||||
|
||||
if (fd)
|
||||
|
||||
Reference in New Issue
Block a user