socklen_t addrlen);
int (*libc_dup)(int fd);
int (*libc_dup2)(int oldfd, int newfd);
+ FILE *(*libc_fopen)(const char *name, const char *mode);
#ifdef HAVE_EVENTFD
int (*libc_eventfd)(int count, int flags);
#endif
return swrap.fns.libc_listen(sockfd, backlog);
}
+static FILE *libc_fopen(const char *name, const char *mode)
+{
+ swrap_load_lib_function(SWRAP_LIBC, fopen);
+
+ return swrap.fns.libc_fopen(name, mode);
+}
+
static int libc_vopen(const char *pathname, int flags, va_list ap)
{
long int mode = 0;
return swrap_listen(s, backlog);
}
+/****************************************************************************
+ * FOPEN
+ ***************************************************************************/
+
+static FILE *swrap_fopen(const char *name, const char *mode)
+{
+ FILE *fp;
+
+ fp = libc_fopen(name, mode);
+ if (fp != NULL) {
+ int fd = fileno(fp);
+
+ swrap_remove_stale(fd);
+ }
+
+ return fp;
+}
+
+FILE *fopen(const char *name, const char *mode)
+{
+ return swrap_fopen(name, mode);
+}
+
/****************************************************************************
* OPEN
***************************************************************************/