Skip to content

Commit f32e415

Browse files
jfernandezcgutman
authored andcommitted
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.
1 parent f7dc33c commit f32e415

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libgamestream/client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int load_unique_id(const char* keyDirectory) {
9292
snprintf(uniqueFilePath, PATH_MAX, "%s/%s", keyDirectory, UNIQUE_FILE_NAME);
9393

9494
FILE *fd = fopen(uniqueFilePath, "r");
95-
if (fd == NULL || fread(unique_id, UNIQUEID_CHARS, 1, fd) != UNIQUEID_CHARS) {
95+
if (fd == NULL || fread(unique_id, UNIQUEID_CHARS, 1, fd) != 1) {
9696
snprintf(unique_id,UNIQUEID_CHARS+1,"0123456789ABCDEF");
9797

9898
if (fd)

0 commit comments

Comments
 (0)