1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Move close_all_non_term_fd() shared by SMB and FSP to protocol/common

Stick a note near the OBJS sorting that it is there also to filter out
duplicates, which are now occuring with SMB and FSP compiled in.
This commit is contained in:
Jonas Fonseca 2006-01-16 23:32:27 +01:00 committed by Jonas Fonseca
parent 20c9b6a941
commit 0955086a6f
4 changed files with 8 additions and 48 deletions

View File

@ -93,7 +93,8 @@ endif
#############################################################################
# Internal build rules
# All files in $(OBJS) and any $(subdir)/lib.o are linked into lib.o
# All files in $(OBJS) and any $(subdir)/lib.o are linked into lib.o.
# Sort them to filter out duplicated and get uniform order.
LIB_O_DEPS = \
$(sort $(filter-out $(LIB_O_NAME),$(OBJS))) \
$(foreach subdir,$(sort $(SUBDIRS)),$(wildcard $(subdir)/$(LIB_O_NAME)))

View File

@ -13,6 +13,8 @@ SUBDIRS-$(CONFIG_URI_REWRITE) += rewrite
SUBDIRS = auth file http
OBJS-$(CONFIG_DATA) += data.o
OBJS-$(CONFIG_FSP) += common.o
OBJS-$(CONFIG_SMB) += common.o
OBJS = about.o date.o header.o protocol.o proxy.o uri.o user.o

View File

@ -13,13 +13,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* FreeBSD needs this before resource.h */
#endif
#include <sys/types.h> /* FreeBSD needs this before resource.h */
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h> /* OS/2 needs this after sys/types.h */
#endif
@ -37,6 +30,7 @@
#include "network/connection.h"
#include "network/socket.h"
#include "osdep/osdep.h"
#include "protocol/common.h"
#include "protocol/protocol.h"
#include "protocol/fsp/fsp.h"
#include "protocol/uri.h"
@ -265,22 +259,6 @@ fsp_got_data(struct socket *socket, struct read_buffer *rb)
#undef READ_SIZE
/* Close all non-terminal file descriptors. */
static void
close_all_non_term_fd(void)
{
int n;
int max = 1024;
#ifdef RLIMIT_NOFILE
struct rlimit lim;
if (!getrlimit(RLIMIT_NOFILE, &lim))
max = lim.rlim_max;
#endif
for (n = 3; n < max; n++)
close(n);
}
void
fsp_protocol_handler(struct connection *conn)
{

View File

@ -12,13 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* FreeBSD needs this before resource.h */
#endif
#include <sys/types.h> /* FreeBSD needs this before resource.h */
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h> /* OS/2 needs this after sys/types.h */
#endif
@ -36,6 +30,7 @@
#include "network/connection.h"
#include "network/socket.h"
#include "osdep/osdep.h"
#include "protocol/common.h"
#include "protocol/protocol.h"
#include "protocol/smb/smb.h"
#include "protocol/uri.h"
@ -525,22 +520,6 @@ bye:
}
/* Close all non-terminal file descriptors. */
static void
close_all_non_term_fd(void)
{
int n;
int max = 1024;
#ifdef RLIMIT_NOFILE
struct rlimit lim;
if (!getrlimit(RLIMIT_NOFILE, &lim))
max = lim.rlim_max;
#endif
for (n = 3; n < max; n++)
close(n);
}
void
smb_protocol_handler(struct connection *conn)
{