summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking/rtems
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libnetworking/rtems')
-rw-r--r--cpukit/libnetworking/rtems/Makefile.am25
-rw-r--r--cpukit/libnetworking/rtems/rtems_syscall.c17
2 files changed, 28 insertions, 14 deletions
diff --git a/cpukit/libnetworking/rtems/Makefile.am b/cpukit/libnetworking/rtems/Makefile.am
index 28df4629c4..dfcac20c4b 100644
--- a/cpukit/libnetworking/rtems/Makefile.am
+++ b/cpukit/libnetworking/rtems/Makefile.am
@@ -1,6 +1,6 @@
-##
+##
## $Id$
-##
+##
AUTOMAKE_OPTIONS = foreign 1.4
@@ -15,6 +15,19 @@ C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
+H_FILES = rtems_bsdnet.h rtems_bsdnet_internal.h tftp.h
+
+noinst_HEADERS = $(H_FILES)
+
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems $(H_FILES:%=$(PROJECT_INCLUDE)/rtems/%)
+
+$(PROJECT_INCLUDE)/rtems:
+ @$(mkinstalldirs) $@
+
+$(PROJECT_INCLUDE)/rtems/%.h: %.h
+ $(INSTALL_DATA) $< $@
+
+
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../automake/lib.am
@@ -28,14 +41,12 @@ AM_CPPFLAGS += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC \
$(LIB): $(OBJS)
$(make-library)
-all-local: $(ARCH) $(OBJS) $(LIB)
+all-local: $(PREINSTALL_FILES) $(ARCH) $(OBJS) $(LIB)
.PRECIOUS: $(LIB)
-EXTRA_DIST = issetugid.c rtems_bootp.c rtems_bsdnet.h \
- rtems_bsdnet_internal.h rtems_glue.c rtems_select.c rtems_showicmpstat.c \
+EXTRA_DIST = issetugid.c rtems_bootp.c rtems_glue.c rtems_select.c rtems_showicmpstat.c \
rtems_showifstat.c rtems_showipstat.c rtems_showmbuf.c rtems_showroute.c \
- rtems_showtcpstat.c rtems_showudpstat.c rtems_syscall.c sghostname.c \
- tftp.h
+ rtems_showtcpstat.c rtems_showudpstat.c rtems_syscall.c sghostname.c
include $(top_srcdir)/../../../automake/local.am
diff --git a/cpukit/libnetworking/rtems/rtems_syscall.c b/cpukit/libnetworking/rtems/rtems_syscall.c
index 05217f7212..d04ae95afb 100644
--- a/cpukit/libnetworking/rtems/rtems_syscall.c
+++ b/cpukit/libnetworking/rtems/rtems_syscall.c
@@ -136,11 +136,8 @@ connect (int s, struct sockaddr *name, int namelen)
return -1;
}
error = soconnect (so, nam);
- if (error) {
- errno = error;
- rtems_bsdnet_semaphore_release ();
- return -1;
- }
+ if (error)
+ goto bad;
if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
m_freem(nam);
errno = EINPROGRESS;
@@ -148,15 +145,20 @@ connect (int s, struct sockaddr *name, int namelen)
return -1;
}
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
- so->so_error = soconnsleep (so);
+ error = soconnsleep (so);
+ if (error)
+ break;
}
if (error == 0) {
error = so->so_error;
so->so_error = 0;
}
+ bad:
so->so_state &= ~SS_ISCONNECTING;
m_freem (nam);
- if (error == 0)
+ if (error)
+ errno = error;
+ else
ret = 0;
rtems_bsdnet_semaphore_release ();
return ret;
@@ -605,6 +607,7 @@ getpeersockname (int s, struct sockaddr *name, int *namelen, int pflag)
else
error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, m);
if (error) {
+ m_freem(m);
errno = error;
rtems_bsdnet_semaphore_release ();
return -1;