1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib: Simplify smbconf_txt_load_file()

file_modtime() returns errno, so we can skip the racy file_exist()
call.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Volker Lendecke 2024-11-22 11:13:34 +01:00 committed by Martin Schwenke
parent edc1f99ffa
commit a14fa71db5

View File

@ -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)) {
rc = file_modtime(ctx->path, &mt);
if (rc != 0) {
if (rc == ENOENT) {
return SBC_ERR_BADFILE;
}
rc = file_modtime(ctx->path, &mt);
if (rc != 0) {
/*
* Not worth mapping errno returned
* in rc to SBC_ERR_XXX. Just assume