From a97e5fc6e4f294294d75500068892aea11952773 Mon Sep 17 00:00:00 2001 From: Rin Okuyama Date: Tue, 21 Feb 2017 06:18:37 +0000 Subject: avoid -Wformat errors from clang https://bugs.freedesktop.org/show_bug.cgi?id=99882 Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith --- Xtranssock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xtranssock.c b/Xtranssock.c index 56d52ea..b06579c 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) { -- cgit v1.2.3 From 941cfa50bc2d45f20943fd21bab98e2eceeeb259 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 25 Aug 2018 10:45:04 -0700 Subject: Set freeXLOCAL to NULL after freeing it to prevent double frees We shouldn't be calling the LocalEndTransports routine twice, but just make sure if we do, we don't call free twice on the same pointer. Signed-off-by: Alan Coopersmith --- Xtranslcl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Xtranslcl.c b/Xtranslcl.c index 07625e1..f21f606 100644 --- a/Xtranslcl.c +++ b/Xtranslcl.c @@ -1703,6 +1703,7 @@ TRANS(LocalEndTransports)(void) { prmsg(3,"LocalEndTransports()\n"); free(freeXLOCAL); + freeXLOCAL = NULL; } #define TYPEBUFSIZE 32 -- cgit v1.2.3 From 7bd504f7ab7799ab77ad50eb39f6afdbaf2f9e50 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 25 Aug 2018 11:18:52 -0700 Subject: Use strcasecmp if it's available, instead of lowercasing strings Signed-off-by: Alan Coopersmith --- Xtrans.c | 8 ++++++++ Xtranslcl.c | 17 ++++++++++++++--- xtrans.m4 | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Xtrans.c b/Xtrans.c index 46dc6b9..0e09b25 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 f21f606..9eddf37 100644 --- a/Xtranslcl.c +++ b/Xtranslcl.c @@ -1714,9 +1714,8 @@ static LOCALtrans2dev * TRANS(LocalGetNextTransport)(void) { - int i,j; + int i; char *typetocheck; - char typebuf[TYPEBUFSIZE]; prmsg(3,"LocalGetNextTransport()\n"); while(1) @@ -1731,6 +1730,9 @@ TRANS(LocalGetNextTransport)(void) for(i=0;iTransName, typebuf)) +#else + if (!strcasecmp(thistrans->TransName, typetocheck)) +#endif found = 1; typetocheck = workingXLOCAL; } 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 -- cgit v1.2.3 From 06cfa80fb3d03ca03fd92f9687a77958338e012c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 30 Sep 2018 17:04:51 -0700 Subject: Use fchmod() instead of chmod() when creating named pipes Signed-off-by: Alan Coopersmith --- Xtranslcl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Xtranslcl.c b/Xtranslcl.c index 9eddf37..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); -- cgit v1.2.3 From cd22de616c77328da3410b1eaab541c2d331ffdb Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 19 Nov 2018 23:12:07 -0800 Subject: Update README for gitlab migration Signed-off-by: Alan Coopersmith --- Makefile.am | 2 +- README | 37 ------------------------------------- README.md | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 38 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/Makefile.am b/Makefile.am index 38c34c3..3a719f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ pkgconfigdir = $(datadir)/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 deleted file mode 100644 index 6b1c468..0000000 --- a/README +++ /dev/null @@ -1,37 +0,0 @@ -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, -libX11, libICE, the X font server, and related components. - -It is however, *NOT* a shared library, but code which each consumer -includes and builds it's own copy of with various #ifdef flags to make -each copy slightly different. To support this in the modular build -system, this package simply installs the C source files into -$(prefix)/include/X11/Xtrans and installs a pkg-config file and an -autoconf m4 macro file with the flags needed to use it. - -Documentation of the xtrans API can be found in the included xtrans.xml -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 - -The master development code repository can be found at: - - git://anongit.freedesktop.org/git/xorg/lib/libxtrans - - http://cgit.freedesktop.org/xorg/lib/libxtrans - -For more information on the git code manager, see: - - http://wiki.x.org/wiki/GitPage diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ab2b3c --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +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, +libX11, libICE, the X font server, and related components. + +It is however, *NOT* a shared library, but code which each consumer +includes and builds it's own copy of with various #ifdef flags to make +each copy slightly different. To support this in the modular build +system, this package simply installs the C source files into +$(prefix)/include/X11/Xtrans and installs a pkg-config file and an +autoconf m4 macro file with the flags needed to use it. + +Documentation of the xtrans API can be found in the included xtrans.xml +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. + + -------------------------------------------------------------------------- + +All questions regarding this software should be directed at the +Xorg mailing list: + + https://lists.x.org/mailman/listinfo/xorg + +The master development code repository can be found at: + + https://gitlab.freedesktop.org/xorg/lib/libxtrans + +Please submit bug reports and requests to merge patches there. + +For patch submission instructions, see: + + https://www.x.org/wiki/Development/Documentation/SubmittingPatches -- cgit v1.2.3