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:
Jose Fernandez
2026-06-05 21:07:44 -06:00
committed by Cameron Gutman
parent f7dc33c870
commit f32e415aea
+1 -1
View File
@@ -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)