summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2018-11-25 16:25:22 +0100
committerMatthieu Herrb <matthieu@herrb.eu>2018-11-25 16:25:22 +0100
commit8ad61afa0f20e9ecc81b5cc5fb6fdf2081b258bf (patch)
treedeb1e6a53a5b9bae4cbd02ac370ebfb7d654157f
parent6939f2d5b7334dc94eb3a759bde9d744d2fba9db (diff)
parentcd22de616c77328da3410b1eaab541c2d331ffdb (diff)
Merge remote-tracking branch 'origin/master' into obsd
-rw-r--r--Makefile.am2
-rw-r--r--README.md (renamed from README)19
-rw-r--r--Xtrans.c8
-rw-r--r--Xtranslcl.c25
-rw-r--r--Xtranssock.c2
-rw-r--r--xtrans.m43
6 files changed, 41 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am
index f11440d..b57bf71 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xtrans.pc
MAINTAINERCLEANFILES = ChangeLog INSTALL
-EXTRA_DIST = ${aclocal_DATA}
+EXTRA_DIST = ${aclocal_DATA} README.md
.PHONY: ChangeLog INSTALL
diff --git a/README b/README.md
index 6b1c468..3ab2b3c 100644
--- a/README
+++ b/README.md
@@ -1,3 +1,6 @@
+xtrans - X Network Transport layer shared code
+----------------------------------------------
+
xtrans is a library of code that is shared among various X packages to
handle network protocol transport in a modular fashion, allowing a
single place to add new transport types. It is used by the X server,
@@ -15,23 +18,19 @@ file in DocBook XML format. If 'xmlto' is installed, you can generate text,
html, postscript or pdf versions of the documentation by configuring
the build with --enable-docs, which is the default.
-Please submit bugs & patches to the Xorg bugzilla:
-
- https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
-
-under the component "Lib/xtrans".
+ --------------------------------------------------------------------------
All questions regarding this software should be directed at the
Xorg mailing list:
- http://lists.freedesktop.org/mailman/listinfo/xorg
+ https://lists.x.org/mailman/listinfo/xorg
The master development code repository can be found at:
- git://anongit.freedesktop.org/git/xorg/lib/libxtrans
+ https://gitlab.freedesktop.org/xorg/lib/libxtrans
- http://cgit.freedesktop.org/xorg/lib/libxtrans
+Please submit bug reports and requests to merge patches there.
-For more information on the git code manager, see:
+For patch submission instructions, see:
- http://wiki.x.org/wiki/GitPage
+ https://www.x.org/wiki/Development/Documentation/SubmittingPatches
diff --git a/Xtrans.c b/Xtrans.c
index bec5903..2045d05 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -153,11 +153,14 @@ static Xtransport *
TRANS(SelectTransport) (const char *protocol)
{
+#ifndef HAVE_STRCASECMP
char protobuf[PROTOBUFSIZE];
+#endif
int i;
prmsg (3,"SelectTransport(%s)\n", protocol);
+#ifndef HAVE_STRCASECMP
/*
* Force Protocol to be lowercase as a way of doing
* a case insensitive match.
@@ -169,12 +172,17 @@ TRANS(SelectTransport) (const char *protocol)
for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++)
if (isupper ((unsigned char)protobuf[i]))
protobuf[i] = tolower ((unsigned char)protobuf[i]);
+#endif
/* Look at all of the configured protocols */
for (i = 0; i < NUMTRANS; i++)
{
+#ifndef HAVE_STRCASECMP
if (!strcmp (protobuf, Xtransports[i].transport->TransName))
+#else
+ if (!strcasecmp (protocol, Xtransports[i].transport->TransName))
+#endif
return Xtransports[i].transport;
}
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 07625e1..26b7f63 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -773,11 +773,12 @@ TRANS(NAMEDOpenPipe)(const char *server_path)
prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path);
return(-1);
}
- close(fd);
- if (chmod(server_path, (mode_t)0666) < 0) {
- prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path);
+ if (fchmod(fd, (mode_t)0666) < 0) {
+ prmsg(1, "NAMEDOpenPipe: Can't chmod %s\n", server_path);
+ close(fd);
return(-1);
}
+ close(fd);
} else {
prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path);
return(-1);
@@ -1703,6 +1704,7 @@ TRANS(LocalEndTransports)(void)
{
prmsg(3,"LocalEndTransports()\n");
free(freeXLOCAL);
+ freeXLOCAL = NULL;
}
#define TYPEBUFSIZE 32
@@ -1713,9 +1715,8 @@ static LOCALtrans2dev *
TRANS(LocalGetNextTransport)(void)
{
- int i,j;
+ int i;
char *typetocheck;
- char typebuf[TYPEBUFSIZE];
prmsg(3,"LocalGetNextTransport()\n");
while(1)
@@ -1730,6 +1731,9 @@ TRANS(LocalGetNextTransport)(void)
for(i=0;i<NUMTRANSPORTS;i++)
{
+#ifndef HAVE_STRCASECMP
+ int j;
+ char typebuf[TYPEBUFSIZE];
/*
* This is equivalent to a case insensitive strcmp(),
* but should be more portable.
@@ -1741,6 +1745,9 @@ TRANS(LocalGetNextTransport)(void)
/* Now, see if they match */
if(!strcmp(LOCALtrans2devtab[i].transname,typebuf))
+#else
+ if(!strcasecmp(LOCALtrans2devtab[i].transname,typetocheck))
+#endif
return &LOCALtrans2devtab[i];
}
}
@@ -2011,7 +2018,6 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol,
{
char *typetocheck = NULL;
int found = 0;
- char typebuf[TYPEBUFSIZE];
prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port);
@@ -2019,16 +2025,23 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol,
TRANS(LocalInitTransports)("local");
typetocheck = workingXLOCAL;
while (typetocheck && !found) {
+#ifndef HAVE_STRCASECMP
int j;
+ char typebuf[TYPEBUFSIZE];
+#endif
workingXLOCAL = strchr(workingXLOCAL, ':');
if (workingXLOCAL && *workingXLOCAL)
*workingXLOCAL++ = '\0';
+#ifndef HAVE_STRCASECMP
strncpy(typebuf, typetocheck, TYPEBUFSIZE);
for (j = 0; j < TYPEBUFSIZE; j++)
if (isupper(typebuf[j]))
typebuf[j] = tolower(typebuf[j]);
if (!strcmp(thistrans->TransName, typebuf))
+#else
+ if (!strcasecmp(thistrans->TransName, typetocheck))
+#endif
found = 1;
typetocheck = workingXLOCAL;
}
diff --git a/Xtranssock.c b/Xtranssock.c
index 05b13df..42340fe 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -1519,7 +1519,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr,
tmpaddr = INADDR_NONE;
}
- prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr);
+ prmsg (4,"SocketINETConnect() inet_addr(%s) = %lx\n", host, tmpaddr);
if (tmpaddr == INADDR_NONE) {
if ((hostp = _XGethostbyname(host,hparams)) == NULL) {
diff --git a/xtrans.m4 b/xtrans.m4
index fe128b4..8215e87 100644
--- a/xtrans.m4
+++ b/xtrans.m4
@@ -134,6 +134,9 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
fi
+ # Other functions Xtrans may need
+ AC_CHECK_FUNCS([strcasecmp strlcpy])
+
]) # XTRANS_CONNECTION_FLAGS