diff --git a/src/comp.c b/src/comp.c
index 1bde4ae5821..b81a80b00f8 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -776,7 +776,7 @@ comp_hash_source_file (Lisp_Object filename)
#else
int res = md5_stream (f, SSDATA (digest));
#endif
- fclose (f);
+ emacs_fclose (f);
if (res)
xsignal2 (Qfile_notify_error, build_string ("hashing failed"), filename);
@@ -4749,7 +4749,7 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt,
gcc_jit_context_release (comp.ctxt);
if (logfile)
- fclose (logfile);
+ emacs_fclose (logfile);
comp.ctxt = NULL;
return Qt;
diff --git a/src/lisp.h b/src/lisp.h
index 85de57b0b2f..2f26e5eddce 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -5086,9 +5086,15 @@ extern int emacs_open (const char *, int, int);
extern int emacs_open_noquit (const char *, int, int);
extern int emacs_pipe (int[2]);
extern int emacs_close (int);
+#if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY)
+# define emacs_fclose fclose
+#else
extern int emacs_fclose (FILE *);
+#endif
extern FILE *emacs_fdopen (int, const char *)
ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1);
+extern FILE *emacs_fopen (char const *, char const *)
+ ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1);
extern int emacs_unlink (const char *);
extern int emacs_symlink (const char *, const char *);
extern int emacs_rmdir (const char *);
diff --git a/src/sysdep.c b/src/sysdep.c
index a995bc66741..0f8b70c8248 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2644,15 +2644,13 @@ emacs_fdopen (int fd, const char *mode)
clear information associated with the FILE's file descriptor if
necessary. */
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
int
emacs_fclose (FILE *stream)
{
-#if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY)
- return fclose (stream);
-#else
return android_fclose (stream);
-#endif
}
+#endif
/* Wrappers around unlink, symlink, rename, renameat_noreplace, and
rmdir. These operations handle asset and content directories on
@@ -3492,7 +3490,7 @@ get_up_time (void)
Lisp_Object subsec = Fcons (make_fixnum (upfrac), make_fixnum (hz));
up = Ftime_add (sec, subsec);
}
- fclose (fup);
+ emacs_fclose (fup);
}
unblock_input ();
@@ -3540,7 +3538,7 @@ procfs_ttyname (int rdev)
}
}
}
- fclose (fdev);
+ emacs_fclose (fdev);
}
unblock_input ();
return build_string (name);
@@ -3582,7 +3580,7 @@ procfs_get_total_memory (void)
}
while (!done);
- fclose (fmem);
+ emacs_fclose (fmem);
}
unblock_input ();
return retval;
diff --git a/src/sysstdio.h b/src/sysstdio.h
index 5a973c833cc..8e9e5bec86c 100644
--- a/src/sysstdio.h
+++ b/src/sysstdio.h
@@ -28,8 +28,6 @@ along with GNU Emacs. If not, see . */
#include
#include
-extern FILE *emacs_fopen (char const *, char const *)
- ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (fclose, 1);
extern void errputc (int);
extern void errwrite (void const *, ptrdiff_t);
extern void close_output_streams (void);