diff --recursive --unified vnc-3.3.7-unixsrc.orig/Xvnc/programs/Xserver/Xvnc.man vnc-3.3.7-unixsrc.log/Xvnc/programs/Xserver/Xvnc.man
--- vnc-3.3.7-unixsrc.orig/Xvnc/programs/Xserver/Xvnc.man	Fri Feb 28 19:47:10 2003
+++ vnc-3.3.7-unixsrc.log/Xvnc/programs/Xserver/Xvnc.man	Tue Apr 15 20:03:13 2003
@@ -152,6 +152,14 @@
 standard output as a connection to the VNC viewer. See the information on the
 extras page on the web site for details.
 
+.TP
+.B \-logdir \fIdirectory\fP
+Write a log file in the specified directory. The log file will have the name
+"X\fBn\fPmsgs", where \fBn\fP is the display number. The default is to write
+log messages to the standard error stream if it is open, and otherwise to
+write a log file in the /usr/adm directory if possible. This option is useful
+together with the "-inetd" option.
+
 .SH SEE ALSO
 .BR vncconnect (1),
 .BR vncpasswd (1),
diff --recursive --unified vnc-3.3.7-unixsrc.orig/Xvnc/programs/Xserver/os/osinit.c vnc-3.3.7-unixsrc.log/Xvnc/programs/Xserver/os/osinit.c
--- vnc-3.3.7-unixsrc.orig/Xvnc/programs/Xserver/os/osinit.c	Thu Aug  8 13:14:31 2002
+++ vnc-3.3.7-unixsrc.log/Xvnc/programs/Xserver/os/osinit.c	Tue Apr 15 20:31:43 2003
@@ -71,6 +71,7 @@
 #endif
 
 extern char *display;
+extern char* logDirName;
 #ifdef RLIMIT_DATA
 int limitDataSpace = -1;
 #endif
@@ -100,10 +101,17 @@
 	fclose(stdout);
 #endif
 	/* hack test to decide where to log errors */
-	if (write (2, fname, 0)) 
+        if (logDirName != NULL || write (2, fname, 0))
 	{
 	    FILE *err;
-	    sprintf (fname, ADMPATH, display);
+            if (logDirName != NULL)
+            {
+                sprintf (fname, "%s/X%smsgs", logDirName, display);
+            }
+            else
+            {
+                sprintf (fname, ADMPATH, display);
+            }
 	    /*
 	     * uses stdio to avoid os dependencies here,
 	     * a real os would use
diff --recursive --unified vnc-3.3.7-unixsrc.orig/Xvnc/programs/Xserver/os/utils.c vnc-3.3.7-unixsrc.log/Xvnc/programs/Xserver/os/utils.c
--- vnc-3.3.7-unixsrc.orig/Xvnc/programs/Xserver/os/utils.c	Thu Aug  8 13:14:31 2002
+++ vnc-3.3.7-unixsrc.log/Xvnc/programs/Xserver/os/utils.c	Tue Apr 15 20:07:41 2003
@@ -137,6 +137,7 @@
 
 Bool CoreDump;
 Bool noTestExtensions;
+char* logDirName = NULL;
 
 int auditTrailLevel = 1;
 
@@ -558,6 +559,7 @@
 #ifdef SERVER_LOCK
     ErrorF("-nolock                disable the locking mechanism\n");
 #endif
+    ErrorF("-logdir directory      select directory to write log file in\n");
 #ifndef NOLOGOHACK
     ErrorF("-logo                  enable logo in screen saver\n");
     ErrorF("nologo                 disable logo in screen saver\n");
@@ -816,6 +818,18 @@
 	    nolock = TRUE;
 	}
 #endif
+        else if ( strcasecmp( argv[i], "-logdir") == 0)
+        {
+            i++;
+            if(i < argc)
+            {
+                logDirName = argv[i];
+            }
+            else
+            {
+                UseMsg();
+            }
+        }
 #ifndef NOLOGOHACK
 	else if ( strcmp( argv[i], "-logo") == 0)
 	{
