Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
c3f43e83
Commit
c3f43e83
authored
Oct 13, 2016
by
Ulrich Sibiller
Committed by
Mike Gabriel
Nov 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace PRMSG by prmsg
parent
c4b775f6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
151 additions
and
140 deletions
+151
-140
Xtrans.c
nx-X11/lib/xtrans/Xtrans.c
+63
-65
Xtransint.h
nx-X11/lib/xtrans/Xtransint.h
+58
-47
Xtranslcl.c
nx-X11/lib/xtrans/Xtranslcl.c
+0
-0
Xtranssock.c
nx-X11/lib/xtrans/Xtranssock.c
+0
-0
Xtransutil.c
nx-X11/lib/xtrans/Xtransutil.c
+27
-28
transport.c
nx-X11/lib/xtrans/transport.c
+3
-0
No files found.
nx-X11/lib/xtrans/Xtrans.c
View file @
c3f43e83
This diff is collapsed.
Click to expand it.
nx-X11/lib/xtrans/Xtransint.h
View file @
c3f43e83
...
...
@@ -306,6 +306,9 @@ typedef struct _Xtransport_table {
/* Flags to preserve when setting others */
#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
#ifdef XTRANS_TRANSPORT_C
/* only provide static function prototypes when
building the transport.c file that has them in */
/*
* readv() and writev() don't exist or don't work correctly on some
* systems, so they may be emulated.
...
...
@@ -360,54 +363,62 @@ static int trans_mkdir (
* Some XTRANSDEBUG stuff
*/
#if defined(XTRANSDEBUG)
/* add hack to the format string to avoid warnings about extra arguments
* to fprintf.
#ifdef XTRANSDEBUG
#include <stdarg.h>
/*
* The X server provides ErrorF() & VErrorF(), for other software that uses
* xtrans, we provide our own simple versions.
*/
#ifdef XTRANSDEBUGTIMESTAMP
#if defined(XSERV_t) && defined(TRANS_SERVER)
/* Use ErrorF() for the X server */
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
struct timeval tp;\
gettimeofday(&tp,0); \
ErrorF("%s",__xtransname); \
ErrorF(x+hack,a,b,c); \
ErrorF("timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
errno=saveerrno; \
} else ((void)0)
#else
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
struct timeval tp;\
gettimeofday(&tp,0); \
fprintf(stderr, "%s",__xtransname); fflush(stderr); \
fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
fprintf(stderr, "timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
fflush(stderr); \
errno=saveerrno; \
} else ((void)0)
#endif
/* XSERV_t && TRANS_SERVER */
#else
/* XTRANSDEBUGTIMESTAMP */
#if defined(XSERV_t) && defined(TRANS_SERVER)
/* Use ErrorF() for the X server */
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
ErrorF("%s",__xtransname); \
ErrorF(x+hack,a,b,c); \
errno=saveerrno; \
} else ((void)0)
#else
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
fprintf(stderr, "%s",__xtransname); fflush(stderr); \
fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
errno=saveerrno; \
} else ((void)0)
#endif
/* XSERV_t && TRANS_SERVER */
#endif
/* XTRANSDEBUGTIMESTAMP */
#else
#define PRMSG(lvl,x,a,b,c) ((void)0)
# if defined(XSERV_t) && defined(TRANS_SERVER)
# include "os.h"
# else
static
inline
void
_X_ATTRIBUTE_PRINTF
(
1
,
0
)
VErrorF
(
const
char
*
f
,
va_list
args
)
{
vfprintf
(
stderr
,
f
,
args
);
fflush
(
stderr
);
}
static
inline
void
_X_ATTRIBUTE_PRINTF
(
1
,
2
)
ErrorF
(
const
char
*
f
,
...)
{
va_list
args
;
va_start
(
args
,
f
);
VErrorF
(
f
,
args
);
va_end
(
args
);
}
# endif
/* xserver */
#endif
/* XTRANSDEBUG */
static
inline
void
_X_ATTRIBUTE_PRINTF
(
2
,
3
)
prmsg
(
int
lvl
,
const
char
*
f
,
...)
{
#ifdef XTRANSDEBUG
va_list
args
;
va_start
(
args
,
f
);
if
(
lvl
<=
XTRANSDEBUG
)
{
int
saveerrno
=
errno
;
ErrorF
(
"%s"
,
__xtransname
);
VErrorF
(
f
,
args
);
# ifdef XTRANSDEBUGTIMESTAMP
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
0
);
ErrorF
(
"timestamp (ms): %d
\n
"
,
tp
.
tv_sec
*
1000
+
tp
.
tv_usec
/
1000
);
}
# endif
errno
=
saveerrno
;
}
va_end
(
args
);
#endif
/* XTRANSDEBUG */
}
#endif
/* XTRANS_TRANSPORT_C */
#endif
/* _XTRANSINT_H_ */
nx-X11/lib/xtrans/Xtranslcl.c
View file @
c3f43e83
This diff is collapsed.
Click to expand it.
nx-X11/lib/xtrans/Xtranssock.c
View file @
c3f43e83
This diff is collapsed.
Click to expand it.
nx-X11/lib/xtrans/Xtransutil.c
View file @
c3f43e83
...
...
@@ -87,7 +87,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
{
PRMSG
(
2
,
"ConvertAddress(%d,%d,%x)
\n
"
,
*
familyp
,
*
addrlenp
,
*
addrp
);
prmsg
(
2
,
"ConvertAddress(%d,%d,%x)
\n
"
,
*
familyp
,
*
addrlenp
,
*
addrp
);
switch
(
*
familyp
)
{
...
...
@@ -174,8 +174,8 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
#endif
default:
PRMSG
(
1
,
"ConvertAddress: Unknown family type %d
\n
"
,
*
familyp
,
0
,
0
);
prmsg
(
1
,
"ConvertAddress: Unknown family type %d
\n
"
,
*
familyp
);
return
-
1
;
}
...
...
@@ -426,7 +426,7 @@ TRANS(WSAStartup) (void)
{
static
WSADATA
wsadata
;
PRMSG
(
2
,
"WSAStartup()
\n
"
,
0
,
0
,
0
);
prmsg
(
2
,
"WSAStartup()
\n
"
);
if
(
!
wsadata
.
wVersion
&&
WSAStartup
(
0x0101
,
&
wsadata
))
return
1
;
...
...
@@ -474,8 +474,8 @@ trans_mkdir(char *path, int mode)
if
(
lstat
(
path
,
&
buf
)
!=
0
)
{
if
(
errno
!=
ENOENT
)
{
PRMSG
(
1
,
"mkdir: ERROR: (l)stat failed for %s (%d)
\n
"
,
path
,
errno
,
0
);
prmsg
(
1
,
"mkdir: ERROR: (l)stat failed for %s (%d)
\n
"
,
path
,
errno
);
return
-
1
;
}
/* Dir doesn't exist. Try to create it */
...
...
@@ -488,15 +488,15 @@ trans_mkdir(char *path, int mode)
*/
if
(
geteuid
()
!=
0
)
{
if
(
mode
&
01000
)
{
PRMSG
(
1
,
"mkdir: ERROR: euid != 0,"
prmsg
(
1
,
"mkdir: ERROR: euid != 0,"
"directory %s will not be created.
\n
"
,
path
,
0
,
0
);
path
);
#ifdef FAIL_HARD
return
-
1
;
#endif
}
else
{
PRMSG
(
1
,
"mkdir: Cannot create %s with root ownership
\n
"
,
path
,
0
,
0
);
prmsg
(
1
,
"mkdir: Cannot create %s with root ownership
\n
"
,
path
);
}
}
#endif
...
...
@@ -504,8 +504,8 @@ trans_mkdir(char *path, int mode)
#ifndef WIN32
if
(
mkdir
(
path
,
mode
)
==
0
)
{
if
(
chmod
(
path
,
mode
))
{
PRMSG
(
1
,
"mkdir: ERROR: Mode of %s should be set to %04o
\n
"
,
path
,
mode
,
0
);
prmsg
(
1
,
"mkdir: ERROR: Mode of %s should be set to %04o
\n
"
,
path
,
mode
);
#ifdef FAIL_HARD
return
-
1
;
#endif
...
...
@@ -514,8 +514,8 @@ trans_mkdir(char *path, int mode)
if
(
mkdir
(
path
)
==
0
)
{
#endif
}
else
{
PRMSG
(
1
,
"mkdir: ERROR: Cannot create %s
\n
"
,
path
,
0
,
0
);
prmsg
(
1
,
"mkdir: ERROR: Cannot create %s
\n
"
,
path
);
return
-
1
;
}
...
...
@@ -573,8 +573,8 @@ trans_mkdir(char *path, int mode)
struct
stat
fbuf
;
if
((
fd
=
open
(
path
,
O_RDONLY
))
!=
-
1
)
{
if
(
fstat
(
fd
,
&
fbuf
)
==
-
1
)
{
PRMSG
(
1
,
"mkdir: ERROR: fstat failed for %s (%d)
\n
"
,
path
,
errno
,
0
);
prmsg
(
1
,
"mkdir: ERROR: fstat failed for %s (%d)
\n
"
,
path
,
errno
);
return
-
1
;
}
/*
...
...
@@ -584,8 +584,8 @@ trans_mkdir(char *path, int mode)
if
(
!
S_ISDIR
(
fbuf
.
st_mode
)
||
buf
.
st_dev
!=
fbuf
.
st_dev
||
buf
.
st_ino
!=
fbuf
.
st_ino
)
{
PRMSG
(
1
,
"mkdir: ERROR: inode for %s changed
\n
"
,
path
,
0
,
0
);
prmsg
(
1
,
"mkdir: ERROR: inode for %s changed
\n
"
,
path
);
return
-
1
;
}
if
(
updateOwner
&&
fchown
(
fd
,
0
,
0
)
==
0
)
...
...
@@ -600,28 +600,27 @@ trans_mkdir(char *path, int mode)
if
(
updateOwner
&&
!
updatedOwner
)
{
#ifdef FAIL_HARD
if
(
status
&
FAIL_IF_NOT_ROOT
)
{
PRMSG
(
1
,
"mkdir: ERROR: Owner of %s must be set to root
\n
"
,
path
,
0
,
0
);
prmsg
(
1
,
"mkdir: ERROR: Owner of %s must be set to root
\n
"
,
path
);
return
-
1
;
}
#endif
PRMSG
(
1
,
"mkdir: Owner of %s should be set to root
\n
"
,
path
,
0
,
0
);
prmsg
(
1
,
"mkdir: Owner of %s should be set to root
\n
"
,
path
);
}
if
(
updateMode
&&
!
updatedMode
)
{
#ifdef FAIL_HARD
if
(
status
&
FAIL_IF_NOMODE
)
{
PRMSG
(
1
,
"mkdir: ERROR: Mode of %s must be set to %04o
\n
"
,
path
,
mode
,
0
);
prmsg
(
1
,
"mkdir: ERROR: Mode of %s must be set to %04o
\n
"
,
path
,
mode
);
return
-
1
;
}
#endif
PRMSG
(
1
,
"mkdir: Mode of %s should be set to %04o
\n
"
,
path
,
mode
,
0
);
prmsg
(
1
,
"mkdir: Mode of %s should be set to %04o
\n
"
,
path
,
mode
);
if
(
status
&
WARN_NO_ACCESS
)
{
PRMSG
(
1
,
"mkdir: this may cause subsequent errors
\n
"
,
0
,
0
,
0
);
prmsg
(
1
,
"mkdir: this may cause subsequent errors
\n
"
);
}
}
return
0
;
...
...
nx-X11/lib/xtrans/transport.c
View file @
c3f43e83
...
...
@@ -54,6 +54,9 @@ from The Open Group.
#include <stdlib.h>
#endif
#define XTRANS_TRANSPORT_C
/* used to flag Xtransint.h that it's being used
here, not just #included in another file */
#include "Xtransint.h"
#ifdef LOCALCONN
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment