summaryrefslogtreecommitdiff
path: root/Xtransutil.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-23 22:35:03 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-01 08:55:11 -0700
commitb1b69ce8e8e4fe0f190c8bd85b537309e71055c8 (patch)
treea6480c97e61c66ea6b4dcda42345d3bf9c6209a6 /Xtransutil.c
parentcbdb434033da1725a69014cc6e4d89c691a6fd95 (diff)
downloadxorg-lib-libxtrans-b1b69ce8e8e4fe0f190c8bd85b537309e71055c8.tar.gz
Convert PRMSG macro to prmsg inline function
Allows using varargs to have the correct number of arguments passed to get rid of the many gcc warnings about variable printf format strings, and to reduce the duplication from having 5 implementations of the PRMSG macro depending on the debug options defined & output method used. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'Xtransutil.c')
-rw-r--r--Xtransutil.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/Xtransutil.c b/Xtransutil.c
index 56f0158..d44dbe9 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -91,7 +91,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 )
{
@@ -178,8 +178,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;
}
@@ -437,7 +437,7 @@ TRANS(WSAStartup) (void)
{
static WSADATA wsadata;
- PRMSG (2,"WSAStartup()\n", 0, 0, 0);
+ prmsg (2,"WSAStartup()\n");
if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata))
return 1;
@@ -485,8 +485,8 @@ trans_mkdir(const 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 */
@@ -499,15 +499,15 @@ trans_mkdir(const 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
@@ -515,8 +515,8 @@ trans_mkdir(const 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
@@ -525,8 +525,8 @@ trans_mkdir(const 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;
}
@@ -584,8 +584,8 @@ trans_mkdir(const 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;
}
/*
@@ -595,8 +595,8 @@ trans_mkdir(const 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)
@@ -611,30 +611,29 @@ trans_mkdir(const 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
#if !defined(__APPLE_CC__) && !defined(__CYGWIN__)
- 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);
#endif
}
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;