From: Theo Buehler Subject: x11/gentoo build fix for opaque FILE To: ports@openbsd.org Cc: yasuoka@openbsd.org Date: Sun, 13 Jul 2025 00:09:07 +0200 I don't think this code is actually used. The static FILE themselves are just placeholders as is explained in the nearby comments. Instead of addresses to statics, we can just open the files normally use the pointers for copmarison and close them again. mntent_wrap.c:112:13: error: tentative definition has type 'FILE' (aka 'struct __sFILE') that is never completed 112 | static FILE f_fstab, f_mtab; | ^ Index: patches/patch-src_mntent_wrap_c =================================================================== RCS file: patches/patch-src_mntent_wrap_c diff -N patches/patch-src_mntent_wrap_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_mntent_wrap_c 12 Jul 2025 14:07:11 -0000 @@ -0,0 +1,80 @@ +Index: src/mntent_wrap.c +--- src/mntent_wrap.c.orig ++++ src/mntent_wrap.c +@@ -109,7 +109,7 @@ gint mne_endmntent(FILE *filep) + ** of what kind of mount entries we're supposed to deal with. Since gentoo will + ** pass a FILE pointer to mne_getmntent() anyway, it seems natural to use it. + */ +-static FILE f_fstab, f_mtab; ++static FILE *f_fstab, *f_mtab; + + /* These are used when we're accessing the currently mounted filesystems, using + ** a call to getmntinfo(). The mtab_pos and mtab_num integers are then used to +@@ -131,29 +131,34 @@ FILE * mne_setmntent(const gchar *filename) + + if(strcmp(filename, "/etc/fstab") == 0) /* Looking for available filesystems? */ + { +- if(setfsent() == 1) +- return &f_fstab; ++ if(setfsent() == 1) { ++ if (f_fstab == NULL) ++ f_fstab = fopen(filename, "r"); ++ return f_fstab; ++ } + } + else if(strcmp(filename, "/proc/mtab") == 0) /* Looking for mounted filesystems? */ + { + if((mtab_num = getmntinfo(&mtab, 0)) > 0) + { + mtab_pos = 0; +- return &f_mtab; ++ if (f_mtab == NULL) ++ f_mtab = fopen(filename, "r"); ++ return f_mtab; + } + } + return NULL; + } + +-/* 1999-05-09 - Get another entry of data, either about mounted (filep == &f_mtab) or available +-** (filep == &f_fstab) filesystems. Returns NULL when the respective data source ++/* 1999-05-09 - Get another entry of data, either about mounted (filep == f_mtab) or available ++** (filep == f_fstab) filesystems. Returns NULL when the respective data source + ** is exhausted. + */ + const MntEnt * mne_getmntent(FILE *filep) + { + static MntEnt me; + +- if(filep == &f_fstab) ++ if(filep == f_fstab) + { + struct fstab *ment; + +@@ -164,7 +169,7 @@ const MntEnt * mne_getmntent(FILE *filep) + return &me; + } + } +- else if(filep == &f_mtab) ++ else if(filep == f_mtab) + { + if(mtab_pos == mtab_num) /* Array exhausted? */ + return NULL; +@@ -182,8 +187,16 @@ const MntEnt * mne_getmntent(FILE *filep) + /* 1999-05-09 - Stop traversing mount/fs data. */ + gint mne_endmntent(FILE *filep) + { +- if(filep == &f_fstab) ++ if (filep == NULL) ++ return 0; ++ if(filep == f_fstab) { ++ fclose(f_fstab); ++ f_fstab = NULL; + endfsent(); ++ } else if (filep == f_mtab) { ++ fclose(f_mtab); ++ f_mtab = NULL; ++ } + + return 0; + }