diff --git a/source/texk/web2c/luatexdir/ChangeLog b/source/texk/web2c/luatexdir/ChangeLog
index 9454d04d5ab533f34369bef7206f23a847c00af1..d0be010ac9c5fc2c80e0976c5b2750e4859890d4 100644
--- a/source/texk/web2c/luatexdir/ChangeLog
+++ b/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,6 @@
+2022-07-31  Luigi Scarso <luigi.scarso@gmail.com>
+    * Fixed loading .tex when  --output-directory is enabled
+
 2022-07-30  Luigi Scarso <luigi.scarso@gmail.com>
     * Backtrack replace pointer when successive disc in exceptions  (H.Hagen)
 
diff --git a/source/texk/web2c/luatexdir/tex/texfileio.c b/source/texk/web2c/luatexdir/tex/texfileio.c
index 8d8cdc04363dacc571b32175d7961e68f1d7c68d..83a76a21f008450f567f43ee3606df840ad56e57 100644
--- a/source/texk/web2c/luatexdir/tex/texfileio.c
+++ b/source/texk/web2c/luatexdir/tex/texfileio.c
@@ -92,17 +92,12 @@ int read_file_callback_id[17];
 static char *find_in_output_directory(const char *s)
 {
     if (output_directory && !kpse_absolute_p(s, false)) {
-        FILE *f_ptr;
         char *ftemp = concat3(output_directory, DIR_SEP_STRING, s);
+	char *ret_val = NULL ;
         /*tex This code is used for input files only. */
-        f_ptr = fopen(ftemp, "rb");
-        if (f_ptr) {
-            fclose(f_ptr);
-            return ftemp;
-        } else {
-            free(ftemp);
-
-        }
+	ret_val = kpse_find_file(ftemp, kpse_tex_format, 1);
+	free(ftemp);
+	return ret_val;
     }
     return NULL;
 }