3 Copyright 1988, 1998 The Open Group
4 Copyright 2000-2004 Oswald Buddenhagen <ossi@kde.org>
6 Permission to use, copy, modify, distribute, and sell this software and its
7 documentation for any purpose is hereby granted without fee, provided that
8 the above copyright notice appear in all copies and that both that
9 copyright notice and this permission notice appear in supporting
12 The above copyright notice and this permission notice shall be included
13 in all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 OTHER DEALINGS IN THE SOFTWARE.
23 Except as contained in this notice, the name of a copyright holder shall
24 not be used in advertising or otherwise to promote the sale, use or
25 other dealings in this Software without prior written authorization
26 from the copyright holder.
31 * xdm - display manager daemon
32 * Author: Keith Packard, MIT X Consortium
34 * Log display manager errors to a file as
35 * we generally do not have a terminal to talk to
36 * or use syslog if it exists
46 #define LOG_DEBUG_MASK DEBUG_CORE
47 #define LOG_PANIC_EXIT 1
53 gDebug( const char *fmt
, ... )
57 if (debugLevel
& DEBUG_HLPCON
) {
58 va_start( args
, fmt
);
59 logger( DM_DEBUG
, fmt
, args
);
65 panic( const char *mesg
)
67 int fd
= open( "/dev/console", O_WRONLY
);
68 write( fd
, "xdm panic: ", 11 );
69 write( fd
, mesg
, strlen( mesg
) );
73 syslog( LOG_ALERT
, "%s", mesg
);
82 if (!(debugLevel
& DEBUG_NOSYSLOG
))
88 initErrorLog( const char *errorLogFile
)
96 /* We do this independently of using syslog, as we cannot redirect
97 * the output of external programs to syslog.
99 if (!errorLogFile
|| strcmp( errorLogFile
, "-" )) {
101 sprintf( buf
, "/var/log/%s.log", prog
);
104 if ((fd
= open( errorLogFile
, O_CREAT
| O_APPEND
| O_WRONLY
, 0666 )) < 0)
105 logError( "Cannot open log file %s\n", errorLogFile
);
109 # define PAMLOG " PAM logs messages related to authentication to authpriv.*."
114 "********************************************************************************\n" \
115 "Note that your system uses syslog. All of kdm's internally generated messages\n" \
116 "(i.e., not from libraries and external programs/scripts it uses) go to the\n" \
117 "daemon.* syslog facility; check your syslog configuration to find out to which\n" \
118 "file(s) it is logged." PAMLOG "\n" \
119 "********************************************************************************\n\n"
120 if (!lseek( fd
, 0, SEEK_END
))
121 write( fd
, WARNMSG
, sizeof(WARNMSG
) - 1 );