util: Add helper to get FILE* options
authorRob Clark <robdclark@chromium.org>
Tue, 1 Dec 2020 18:16:36 +0000 (10:16 -0800)
committerMarge Bot <eric+marge@anholt.net>
Thu, 3 Dec 2020 21:19:57 +0000 (21:19 +0000)
commita1440ec3daaa4f95b5ce007157ae1371c39da5b6
treefe9b672b1c7b4522e67074335b70b6012e1981bb
parent1e4cd12c8bf5c7ecf829f203b0162f7268da03cc
util: Add helper to get FILE* options

Add a helper to get debug options that specify a file path, with
additional checking for suid to prevent unintended file access via
mesa's debug features.

Unlike other DEBUG_GET_ONCE_*, this returns a new file ptr each time
it is called (although it only does the lookup of the path once).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Acked-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7818>
src/util/u_debug.h