From a14fa71db5af891a6c34c8f7d8d730689bd0021c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 22 Nov 2024 11:13:34 +0100 Subject: [PATCH] lib: Simplify smbconf_txt_load_file() file_modtime() returns errno, so we can skip the racy file_exist() call. Signed-off-by: Volker Lendecke Reviewed-by: Martin Schwenke --- lib/smbconf/smbconf_txt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/smbconf/smbconf_txt.c b/lib/smbconf/smbconf_txt.c index 70a35ec4304..f090430b348 100644 --- a/lib/smbconf/smbconf_txt.c +++ b/lib/smbconf/smbconf_txt.c @@ -187,12 +187,12 @@ static sbcErr smbconf_txt_load_file(struct smbconf_ctx *ctx) int rc; struct timespec mt = {0}; - if (!file_exist(ctx->path)) { - return SBC_ERR_BADFILE; - } - rc = file_modtime(ctx->path, &mt); if (rc != 0) { + if (rc == ENOENT) { + return SBC_ERR_BADFILE; + } + /* * Not worth mapping errno returned * in rc to SBC_ERR_XXX. Just assume -- 2.47.3