debuginfod: Make sure debuginfod_config_cache always returns valid stat
authorMark Wielaard <mark@klomp.org>
Sun, 8 May 2022 21:55:19 +0000 (23:55 +0200)
committerMark Wielaard <mark@klomp.org>
Sat, 14 May 2022 22:18:18 +0000 (00:18 +0200)
commita6b3e9dd4e725e1500872f3726f97954b81d59ad
treef2540f376fa40092c94c11a63c4a4b4844a6d9d5
parent4b5c8d1380715123f1b832fca932722e8c6651d2
debuginfod: Make sure debuginfod_config_cache always returns valid stat

If the condig file which value was requested from
debuginfod_config_cache didn't exist yet, stat would fail and no valid
struct stat would be returned even when the file was correctly
created. Fix this by always using O_CREAT to open the file, and reuse
that file descriptor to call fstat and for either writing the default
value or reading the config file value.

Signed-off-by: Mark Wielaard <mark@klomp.org>
debuginfod/ChangeLog
debuginfod/debuginfod-client.c