[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-312-g03a980d

Michael Adam obnox at samba.org
Wed Mar 19 21:48:32 GMT 2008


The branch, v3-2-test has been updated
       via  03a980d8f67ee1516c357807c23a405f07a006b3 (commit)
       via  6c53753246b8108fe1277b34958e122bd800c4e7 (commit)
      from  24018d882d1b1cfece47c533fe5bbca91de124cc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 03a980d8f67ee1516c357807c23a405f07a006b3
Author: Michael Adam <obnox at samba.org>
Date:   Tue Mar 18 17:50:23 2008 +0100

    libreplace: replace.c does not need system/network.h anymore.
    
    Michael
    (cherry picked from commit 2d3c2f34f33338ff422047dae9cc262522689328)

commit 6c53753246b8108fe1277b34958e122bd800c4e7
Author: Michael Adam <obnox at samba.org>
Date:   Tue Mar 18 17:20:47 2008 +0100

    libreplace: move rep_socketpair() to its own module.
    
    Prototype is now in system/network.h,
    implementation in socketpair.c, and
    check in socketpair.m4.
    
    Now the last networking function has vanished from replace.c.
    
    Michael
    (cherry picked from commit 94ac8a25be15b55f66eff96fdddc2fdc71a43b1e)

-----------------------------------------------------------------------

Summary of changes:
 source/lib/replace/libreplace.m4                 |    3 +-
 source/lib/replace/replace.c                     |   23 --------------------
 source/lib/replace/replace.h                     |    2 +-
 source/lib/replace/{inet_aton.c => socketpair.c} |   25 ++++++++++++++++-----
 source/lib/replace/socketpair.m4                 |    1 +
 source/lib/replace/system/network.h              |    5 ++++
 6 files changed, 28 insertions(+), 31 deletions(-)
 copy source/lib/replace/{inet_aton.c => socketpair.c} (72%)
 create mode 100644 source/lib/replace/socketpair.m4


Changeset truncated at 500 lines:

diff --git a/source/lib/replace/libreplace.m4 b/source/lib/replace/libreplace.m4
index 3da2a90..8e17258 100644
--- a/source/lib/replace/libreplace.m4
+++ b/source/lib/replace/libreplace.m4
@@ -158,7 +158,7 @@ fi
 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
 AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
 AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp socketpair)
+AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp)
 AC_CHECK_FUNCS(isatty)
 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
@@ -334,6 +334,7 @@ m4_include(inet_ntoa.m4)
 m4_include(getaddrinfo.m4)
 m4_include(repdir.m4)
 m4_include(getifaddrs.m4)
+m4_include(socketpair.m4)
 
 AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
 
diff --git a/source/lib/replace/replace.c b/source/lib/replace/replace.c
index c16bded..6930f9b 100644
--- a/source/lib/replace/replace.c
+++ b/source/lib/replace/replace.c
@@ -27,7 +27,6 @@
 #include "system/time.h"
 #include "system/passwd.h"
 #include "system/syslog.h"
-#include "system/network.h"
 #include "system/locale.h"
 #include "system/wait.h"
 
@@ -585,25 +584,3 @@ int rep_unsetenv(const char *name)
 	return 0;
 }
 #endif
-
-#ifndef HAVE_SOCKETPAIR
-int rep_socketpair(int d, int type, int protocol, int sv[2])
-{
-	if (d != AF_UNIX) {
-		errno = EAFNOSUPPORT;
-		return -1;
-	}
-
-	if (protocol != 0) {
-		errno = EPROTONOSUPPORT;
-		return -1;
-	}
-
-	if (type != SOCK_STREAM) {
-		errno = EOPNOTSUPP;
-		return -1;
-	}
-
-	return pipe(sv);
-}
-#endif
diff --git a/source/lib/replace/replace.h b/source/lib/replace/replace.h
index 383536d..5fe7939 100644
--- a/source/lib/replace/replace.h
+++ b/source/lib/replace/replace.h
@@ -212,7 +212,7 @@ int rep_dlclose(void *handle);
 
 #ifndef HAVE_SOCKETPAIR
 #define socketpair rep_socketpair
-int rep_socketpair(int d, int type, int protocol, int sv[2]);
+/* prototype is in system/network.h */
 #endif
 
 #ifndef PRINTF_ATTRIBUTE
diff --git a/source/lib/replace/inet_aton.c b/source/lib/replace/socketpair.c
similarity index 72%
copy from source/lib/replace/inet_aton.c
copy to source/lib/replace/socketpair.c
index c6b3bb1..c775730 100644
--- a/source/lib/replace/inet_aton.c
+++ b/source/lib/replace/socketpair.c
@@ -1,6 +1,7 @@
 /*
  * Unix SMB/CIFS implementation.
- * replacement functions
+ * replacement routines for broken systems
+ * Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2006
  * Copyright (C) Michael Adam <obnox at samba.org> 2008
  *
  *  ** NOTE! The following LGPL license applies to the replace
@@ -24,10 +25,22 @@
 #include "replace.h"
 #include "system/network.h"
 
-/**
- * We know that we have inet_pton from earlier libreplace checks.
- */
-int rep_inet_aton(const char *src, struct in_addr *dst)
+int rep_socketpair(int d, int type, int protocol, int sv[2])
 {
-	return (inet_pton(AF_INET, src, dst) > 0) ? 1 : 0;
+	if (d != AF_UNIX) {
+		errno = EAFNOSUPPORT;
+		return -1;
+	}
+
+	if (protocol != 0) {
+		errno = EPROTONOSUPPORT;
+		return -1;
+	}
+
+	if (type != SOCK_STREAM) {
+		errno = EOPNOTSUPP;
+		return -1;
+	}
+
+	return pipe(sv);
 }
diff --git a/source/lib/replace/socketpair.m4 b/source/lib/replace/socketpair.m4
new file mode 100644
index 0000000..7088334
--- /dev/null
+++ b/source/lib/replace/socketpair.m4
@@ -0,0 +1 @@
+AC_CHECK_FUNCS(socketpair,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} socketpair.o"])
diff --git a/source/lib/replace/system/network.h b/source/lib/replace/system/network.h
index f943a7f..a5fb813 100644
--- a/source/lib/replace/system/network.h
+++ b/source/lib/replace/system/network.h
@@ -143,6 +143,11 @@ int rep_getifaddrs(struct ifaddrs **);
 void rep_freeifaddrs(struct ifaddrs *);
 #endif
 
+#ifndef HAVE_SOCKETPAIR
+/* define is in "replace.h" */
+int rep_socketpair(int d, int type, int protocol, int sv[2]);
+#endif
+
 /*
  * Some systems have getaddrinfo but not the
  * defines needed to use it.


-- 
Samba Shared Repository


More information about the samba-cvs mailing list