From: Volker Lendecke Date: Fri, 22 Nov 2024 10:13:34 +0000 (+0100) Subject: lib: Simplify smbconf_txt_load_file() X-Git-Tag: tdb-1.4.13~444 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a14fa71db5af891a6c34c8f7d8d730689bd0021c;p=thirdparty%2Fsamba.git 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 --- 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