aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/access.c9
-rw-r--r--xorg-server/os/backtrace.c8
-rw-r--r--xorg-server/os/connection.c14
-rw-r--r--xorg-server/os/io.c19
-rw-r--r--xorg-server/os/osdep.h19
5 files changed, 39 insertions, 30 deletions
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c
index dbce71112..0ec8ebdf7 100644
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@ -1220,6 +1220,13 @@ ComputeLocalClient(ClientPtr client)
return FALSE;
}
+Bool LocalClient(ClientPtr client)
+{
+ if (!client->osPrivate)
+ return FALSE;
+ return ((OsCommPtr)client->osPrivate)->local_client;
+}
+
/*
* Return the uid and gid of a connected local client
*
@@ -1377,7 +1384,7 @@ AuthorizedClient(ClientPtr client)
if (rc != Success)
return rc;
- return client->local ? Success : BadAccess;
+ return LocalClient(client) ? Success : BadAccess;
}
/* Add a host to the access control list. This is the external interface
diff --git a/xorg-server/os/backtrace.c b/xorg-server/os/backtrace.c
index 298bf1898..edaeb17c7 100644
--- a/xorg-server/os/backtrace.c
+++ b/xorg-server/os/backtrace.c
@@ -43,7 +43,8 @@ void xorg_backtrace(void)
const char *mod;
int size, i;
Dl_info info;
- ErrorF("\nBacktrace:\n");
+ ErrorF("\n");
+ ErrorF("Backtrace:\n");
size = backtrace(array, 64);
for (i = 0; i < size; i++) {
int rc = dladdr(array[i], &info);
@@ -59,6 +60,7 @@ void xorg_backtrace(void)
ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod,
info.dli_fbase, (long unsigned int)((char *) array[i] - (char *) info.dli_fbase), array[i]);
}
+ ErrorF("\n");
}
#else /* not glibc or glibc < 2.1 */
@@ -188,7 +190,8 @@ static int xorg_backtrace_pstack(void) {
void xorg_backtrace(void) {
- ErrorF("\nBacktrace:\n");
+ ErrorF("\n");
+ ErrorF("Backtrace:\n");
# ifdef HAVE_PSTACK
/* First try fork/exec of pstack - otherwise fall back to walkcontext
@@ -207,6 +210,7 @@ void xorg_backtrace(void) {
# endif
ErrorF("Failed to get backtrace info: %s\n", strerror(errno));
}
+ ErrorF("\n");
}
# else
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index 1d80f22b3..578640dda 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -774,7 +774,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
free(oc);
return NullClient;
}
- client->local = ComputeLocalClient(client);
+ oc->local_client = ComputeLocalClient(client);
#if !defined(WIN32)
ConnectionTranslation[fd] = client->index;
#else
@@ -911,7 +911,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
xConnSetupPrefix csp;
char pad[3];
struct iovec iov[3];
- char order = 0;
+ char byteOrder = 0;
int whichbyte = 1;
struct timeval waittime;
fd_set mask;
@@ -924,16 +924,16 @@ ErrorConnMax(XtransConnInfo trans_conn)
FD_SET(fd, &mask);
(void)Select(fd + 1, &mask, NULL, NULL, &waittime);
/* try to read the byte-order of the connection */
- (void)_XSERVTransRead(trans_conn, &order, 1);
- if (order == 'l' || order == 'B' || order == 'r' || order == 'R')
+ (void)_XSERVTransRead(trans_conn, &byteOrder, 1);
+ if ((byteOrder == 'l') || (byteOrder == 'B'))
{
csp.success = xFalse;
csp.lengthReason = sizeof(NOROOM) - 1;
csp.length = (sizeof(NOROOM) + 2) >> 2;
csp.majorVersion = X_PROTOCOL;
csp.minorVersion = X_PROTOCOL_REVISION;
- if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
- (!(*(char *) &whichbyte) && (order == 'l' || order == 'r')))
+ if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
+ (!(*(char *) &whichbyte) && (byteOrder == 'l')))
{
swaps(&csp.majorVersion);
swaps(&csp.minorVersion);
@@ -1072,7 +1072,7 @@ CloseDownConnection(ClientPtr client)
ErrorF("CloseDownConnection: client index = %d, socket fd = %d\n",
client->index, oc->fd);
#endif
- if (oc->output)
+ if (oc->output && oc->output->count)
FlushClient(client, oc, (char *)NULL, 0);
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c
index ad549c534..13098f1ee 100644
--- a/xorg-server/os/io.c
+++ b/xorg-server/os/io.c
@@ -84,23 +84,6 @@ SOFTWARE.
CallbackListPtr ReplyCallback;
CallbackListPtr FlushCallback;
-typedef struct _connectionInput {
- struct _connectionInput *next;
- char *buffer; /* contains current client input */
- char *bufptr; /* pointer to current start of data */
- int bufcnt; /* count of bytes in buffer */
- int lenLastReq;
- int size;
- unsigned int ignoreBytes; /* bytes to ignore before the next request */
-} ConnectionInput, *ConnectionInputPtr;
-
-typedef struct _connectionOutput {
- struct _connectionOutput *next;
- unsigned char *buf;
- int size;
- int count;
-} ConnectionOutput, *ConnectionOutputPtr;
-
static ConnectionInputPtr AllocateInputBuffer(void);
static ConnectionOutputPtr AllocateOutputBuffer(void);
@@ -908,7 +891,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
long notWritten;
long todo;
- if (!oco || !oco->count)
+ if (!oco)
return 0;
written = 0;
padsize = padlength[extraCount & 3];
diff --git a/xorg-server/os/osdep.h b/xorg-server/os/osdep.h
index c9add48ee..70e2a0726 100644
--- a/xorg-server/os/osdep.h
+++ b/xorg-server/os/osdep.h
@@ -108,8 +108,22 @@ typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name,
unsigned data_length, char *data);
#endif
-typedef struct _connectionInput *ConnectionInputPtr;
-typedef struct _connectionOutput *ConnectionOutputPtr;
+typedef struct _connectionInput {
+ struct _connectionInput *next;
+ char *buffer; /* contains current client input */
+ char *bufptr; /* pointer to current start of data */
+ int bufcnt; /* count of bytes in buffer */
+ int lenLastReq;
+ int size;
+ unsigned int ignoreBytes; /* bytes to ignore before the next request */
+} ConnectionInput, *ConnectionInputPtr;
+
+typedef struct _connectionOutput {
+ struct _connectionOutput *next;
+ int size;
+ unsigned char *buf;
+ int count;
+} ConnectionOutput, *ConnectionOutputPtr;
struct _osComm;
@@ -148,6 +162,7 @@ typedef struct _osComm {
XID auth_id; /* authorization id */
CARD32 conn_time; /* timestamp if not established, else 0 */
struct _XtransConnInfo *trans_conn; /* transport connection object */
+ Bool local_client;
} OsCommRec, *OsCommPtr;
extern int FlushClient(