| Index: client/mac/sender/crash_report_sender.m
|
| ===================================================================
|
| --- client/mac/sender/crash_report_sender.m (revision 328)
|
| +++ client/mac/sender/crash_report_sender.m (working copy)
|
| @@ -39,6 +39,12 @@
|
| #import "crash_report_sender.h"
|
| #import "common/mac/GTMLogger.h"
|
|
|
| +#if VERBOSE
|
| + bool gDebugLog = true;
|
| +#else
|
| + bool gDebugLog = false;
|
| +#endif
|
| +
|
| #define kLastSubmission @"LastSubmission"
|
| const int kMinidumpFileLengthLimit = 800000;
|
|
|
| @@ -697,6 +703,7 @@
|
|
|
| //=============================================================================
|
| int main(int argc, const char *argv[]) {
|
| + DEBUGLOG(stderr, "Reporter Launched, argc=%d\n", argc);
|
| NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
| // The expectation is that there will be one argument which is the path
|
| // to the configuration file
|
| @@ -707,11 +714,22 @@
|
| // Open the file before (potentially) switching to console user
|
| int configFile = open(argv[1], O_RDONLY, 0600);
|
|
|
| + if (configFile == -1) {
|
| + DEBUGLOG(stderr,
|
| + "Couldn't open config file %s - %s\n",
|
| + argv[1],
|
| + strerror(errno));
|
| + }
|
| +
|
| // we want to avoid a build-up of old config files even if they
|
| // have been incorrectly written by the framework
|
| unlink(argv[1]);
|
|
|
| if (configFile == -1) {
|
| + DEBUGLOG(stderr,
|
| + "Couldn't unlink config file %s - %s\n",
|
| + argv[1],
|
| + strerror(errno));
|
| exit(1);
|
| }
|
|
|
| @@ -719,6 +737,7 @@
|
|
|
| // Gather the configuration data
|
| if (![reporter readConfigurationData]) {
|
| + DEBUGLOG(stderr, "reporter readConfigurationData failed\n");
|
| exit(1);
|
| }
|
|
|
| @@ -742,23 +761,38 @@
|
| struct passwd *pw = getpwnam("nobody");
|
|
|
| // If we can't get a non-root uid, don't send the report
|
| - if (!pw)
|
| + if (!pw) {
|
| + DEBUGLOG(stderr, "!pw - %s\n", strerror(errno));
|
| exit(0);
|
| + }
|
|
|
| - if (setgid(pw->pw_gid) == -1)
|
| + if (setgid(pw->pw_gid) == -1) {
|
| + DEBUGLOG(stderr, "setgid(pw->pw_gid) == -1 - %s\n", strerror(errno));
|
| exit(0);
|
| + }
|
|
|
| - if (setuid(pw->pw_uid) == -1)
|
| + if (setuid(pw->pw_uid) == -1) {
|
| + DEBUGLOG(stderr, "setuid(pw->pw_uid) == -1 - %s\n", strerror(errno));
|
| exit(0);
|
| + }
|
| }
|
| + else {
|
| + DEBUGLOG(stderr, "getuid() !=0 || geteuid() != 0 \n");
|
| + }
|
|
|
| if (okayToSend && shouldSubmitReport) {
|
| + DEBUGLOG(stderr, "Sending Report\n");
|
| [reporter report];
|
| + DEBUGLOG(stderr, "Report Sent!\n");
|
| + } else {
|
| + DEBUGLOG(stderr, "Not sending crash report okayToSend=%d, "\
|
| + "shouldSubmitReport=%d\n", okayToSend, shouldSubmitReport);
|
| }
|
|
|
| // Cleanup
|
| [reporter release];
|
| [pool release];
|
|
|
| + DEBUGLOG(stderr, "Exiting with no errors\n");
|
| return 0;
|
| }
|
|
|