OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 ** prtrace.c -- NSPR Trace Instrumentation | 7 ** prtrace.c -- NSPR Trace Instrumentation |
8 ** | 8 ** |
9 ** Implement the API defined in prtrace.h | 9 ** Implement the API defined in prtrace.h |
10 ** | 10 ** |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 /* Self initialize, if necessary */ | 650 /* Self initialize, if necessary */ |
651 if ( traceLock == NULL ) | 651 if ( traceLock == NULL ) |
652 _PR_InitializeTrace(); | 652 _PR_InitializeTrace(); |
653 | 653 |
654 PR_LOG( lm, PR_LOG_DEBUG, | 654 PR_LOG( lm, PR_LOG_DEBUG, |
655 ("PR_RecordTraceEntries: begins")); | 655 ("PR_RecordTraceEntries: begins")); |
656 | 656 |
657 logLostData = 0; /* reset at entry */ | 657 logLostData = 0; /* reset at entry */ |
658 logState = LogReset; | 658 logState = LogReset; |
659 | 659 |
660 #ifdef XP_UNIX | |
661 if ((getuid() != geteuid()) || (getgid() != getegid())) { | |
662 return NULL; | |
663 } | |
664 #endif /* XP_UNIX */ | |
665 | |
666 /* Get the filename for the logfile from the environment */ | 660 /* Get the filename for the logfile from the environment */ |
667 logFileName = PR_GetEnv( "NSPR_TRACE_LOG" ); | 661 logFileName = PR_GetEnvSecure( "NSPR_TRACE_LOG" ); |
668 if ( logFileName == NULL ) | 662 if ( logFileName == NULL ) |
669 { | 663 { |
670 PR_LOG( lm, PR_LOG_ERROR, | 664 PR_LOG( lm, PR_LOG_ERROR, |
671 ("RecordTraceEntries: Environment variable not defined. Exiting")); | 665 ("RecordTraceEntries: Environment variable not defined. Exiting")); |
672 return NULL; | 666 return NULL; |
673 } | 667 } |
674 | 668 |
675 /* Open the logfile */ | 669 /* Open the logfile */ |
676 logFile = PR_Open( logFileName, PR_WRONLY | PR_CREATE_FILE, 0666 ); | 670 logFile = PR_Open( logFileName, PR_WRONLY | PR_CREATE_FILE, 0666 ); |
677 if ( logFile == NULL ) | 671 if ( logFile == NULL ) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 873 |
880 *found = copied; | 874 *found = copied; |
881 rc = ( fetchLostData == PR_TRUE )? 1 : 0; | 875 rc = ( fetchLostData == PR_TRUE )? 1 : 0; |
882 fetchLostData = PR_FALSE; | 876 fetchLostData = PR_FALSE; |
883 | 877 |
884 PR_Unlock( traceLock ); | 878 PR_Unlock( traceLock ); |
885 return rc; | 879 return rc; |
886 } /* end PR_GetTraceEntries() */ | 880 } /* end PR_GetTraceEntries() */ |
887 | 881 |
888 /* end prtrace.c */ | 882 /* end prtrace.c */ |
OLD | NEW |