+2020-05-27 Bruno Haible <bruno@clisp.org>
+
+ mountlist: Make more robust in multithreaded applications.
+ * lib/mountlist.c (setmntent, read_file_system_list): Pass an 'e' flag
+ to fopen.
+ * modules/mountlist (Depends-on): Add fopen-gnu.
+
2020-05-27 Bruno Haible <bruno@clisp.org>
sethostname: Make more robust in multithreaded applications.
#ifdef MOUNTED_GETMNTENT1
# if !HAVE_SETMNTENT /* Android <= 4.4 */
-# define setmntent(fp,mode) fopen (fp, mode)
+# define setmntent(fp,mode) fopen (fp, mode "e")
# endif
# if !HAVE_ENDMNTENT /* Android <= 4.4 */
# define endmntent(fp) fclose (fp)
(and that code is in previous versions of this function), however
libmount depends on libselinux which pulls in many dependencies. */
char const *mountinfo = "/proc/self/mountinfo";
- fp = fopen (mountinfo, "r");
+ fp = fopen (mountinfo, "re");
if (fp != NULL)
{
char *line = NULL;
char *table = "/etc/mnttab";
FILE *fp;
- fp = fopen (table, "r");
+ fp = fopen (table, "re");
if (fp == NULL)
return NULL;
by the kernel. */
errno = 0;
- fp = fopen (table, "r");
+ fp = fopen (table, "re");
if (fp == NULL)
ret = errno;
else
# endif
errno = 0;
- fp = fopen (table, "r");
+ fp = fopen (table, "re");
if (fp == NULL)
ret = errno;
else