Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Side by Side Diff: chrome/app/breakpad_linux.cc

Issue 113984: A bit more clean up for Linux upload crash dump.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix off by 1 error Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <sys/socket.h> 6 #include <sys/socket.h>
7 #include <sys/uio.h> 7 #include <sys/uio.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 sys_setsid(); 325 sys_setsid();
326 326
327 // Leave one end of a pipe in the wget process and watch for it getting 327 // Leave one end of a pipe in the wget process and watch for it getting
328 // closed by the wget process exiting. 328 // closed by the wget process exiting.
329 int fds[2]; 329 int fds[2];
330 sys_pipe(fds); 330 sys_pipe(fds);
331 331
332 const pid_t child = sys_fork(); 332 const pid_t child = sys_fork();
333 if (child) { 333 if (child) {
334 sys_close(fds[1]); 334 sys_close(fds[1]);
335 char buf[17]; 335 char id_buf[17];
336 HANDLE_EINTR(read(fds[0], buf, sizeof(buf) - 1)); 336 const int len = HANDLE_EINTR(read(fds[0], id_buf, sizeof(id_buf) - 1));
337 buf[sizeof(buf) - 1] = 0; 337 if (len > 0) {
338 static const char msg[] = "\nCrash dump id: "; 338 id_buf[len] = 0;
339 sys_write(2, msg, sizeof(msg) - 1); 339 static const char msg[] = "\nCrash dump id: ";
340 sys_write(2, buf, my_strlen(buf)); 340 sys_write(2, msg, sizeof(msg) - 1);
341 sys_write(2, "\n", 1); 341 sys_write(2, id_buf, my_strlen(buf));
342 sys_write(2, "\n", 1);
343 }
342 sys_unlink(filename); 344 sys_unlink(filename);
343 sys_unlink(buf); 345 sys_unlink(buf);
344 sys__exit(0); 346 sys__exit(0);
345 } 347 }
346 348
347 sys_close(fds[0]); 349 sys_close(fds[0]);
348 sys_dup2(fds[1], 3); 350 sys_dup2(fds[1], 3);
349 static const char* const kWgetBinary = "/usr/bin/wget"; 351 static const char* const kWgetBinary = "/usr/bin/wget";
350 const char* args[] = { 352 const char* args[] = {
351 kWgetBinary, 353 kWgetBinary,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 479
478 // Determine the process type and take appropriate action. 480 // Determine the process type and take appropriate action.
479 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 481 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
480 const std::wstring process_type = 482 const std::wstring process_type =
481 parsed_command_line.GetSwitchValue(switches::kProcessType); 483 parsed_command_line.GetSwitchValue(switches::kProcessType);
482 if (process_type.empty()) 484 if (process_type.empty())
483 EnableCrashDumping(); 485 EnableCrashDumping();
484 else if (process_type == switches::kRendererProcess) 486 else if (process_type == switches::kRendererProcess)
485 EnableRendererCrashDumping(); 487 EnableRendererCrashDumping();
486 } 488 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698