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

Side by Side Diff: tools/android/memtrack_helper/memtrack_helper_test_client.c

Issue 2576713002: Fix memtrack_helper for newer versions Android. (Closed)
Patch Set: nit Created 4 years 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
« no previous file with comments | « tools/android/memtrack_helper/memtrack_helper.c ('k') | 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 /* 1 /*
2 * Copyright 2015 The Chromium Authors. All rights reserved. 2 * Copyright 2015 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 17 matching lines...) Expand all
28 struct sockaddr_un server_addr; 28 struct sockaddr_un server_addr;
29 init_memtrack_server_addr(&server_addr); 29 init_memtrack_server_addr(&server_addr);
30 30
31 if (connect(sock, (struct sockaddr*)&server_addr, sizeof(server_addr))) 31 if (connect(sock, (struct sockaddr*)&server_addr, sizeof(server_addr)))
32 exit_with_failure("connect"); 32 exit_with_failure("connect");
33 33
34 if (send(sock, pid, strlen(pid) + 1, 0) < 0) 34 if (send(sock, pid, strlen(pid) + 1, 0) < 0)
35 exit_with_failure("send"); 35 exit_with_failure("send");
36 36
37 char buf[4096]; 37 char buf[4096];
38 memset(buf, 0, sizeof(buf)); 38 ssize_t rsize = recv(sock, buf, sizeof(buf) - 1, 0);
39 if (recv(sock, buf, sizeof(buf), 0) <= 0) 39 if (rsize < 0)
40 exit_with_failure("recv"); 40 exit_with_failure("recv");
41 buf[rsize] = '\0';
41 42
42 puts(buf); 43 puts(buf);
43 return EXIT_SUCCESS; 44 return EXIT_SUCCESS;
44 } 45 }
OLDNEW
« no previous file with comments | « tools/android/memtrack_helper/memtrack_helper.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698