When child (pid==0) executes fork branch 'pid_str'
will always be 0 writting wrong value to file(s).
Fix by utilizing getpid() to obtain correct pid.
Tracker link provides some insight on why use cases
aren't broken.
Bug: https://code.google.com/p/android/issues/detail?id=200392
Change-Id: I29989365a8bac94502c090918fa30e5cc88eb1ea
Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
Clang static analyzer does not know the transfer of
object ownership to hashmapPut. Use a fake global
pointer variable to trick the analyzer.
BUG: 26955438
Change-Id: Id3ac595fff14e48d28a1147461cd836914857086
brillo::BinderWatcher now requires a brillo::MessageLoop, so this patch
creates a brillo::BaseMessageLoop and passes it when creating the
brillo::BinderWatcher.
Bug: 26356682
TEST=Deployed metricsd to edison-eng.
Change-Id: I6a9e592623faf231205ae44e479bec2b873b8898
fwrite() is a macro that maps to adb_fwrite(), which can write UTF-8 to
the console. Use it to write the output that comes from the subprocess
adb server.
To do this, dup the stdout/stderr file descriptor and make a duplicate
FILE* stream, in binary mode (since we're reading raw bytes from the
subprocess), and unbuffered.
Change-Id: I480761bae0bd576dc9e03fa4d31266f4e49635ed
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
SendFail and SendSyncFail are similarly named, and have the same
prototype. Use `#pragma GCC poison` to prevent use of SendFail in
file_sync_service.cpp, and fix the places where it was used
accidentally.
Change-Id: I6b9a7e565b76dfab10f8ae38f889d046ad80a403
If ashmem accessors are being called with a file descriptor that
belongs to anything other than ashmem, we need to stop it right
now so that they can fix the caller.
Bug: 26871259
Change-Id: Icf9aafc3631a80b9af6fe0fea03599d61e285d21
NB: We decided to not sniff for the constant saved __ashmem_rdev in
the early error path; requiring either the use of atomic operations,
or acquiring a lock to do it correctly. The heroics are not worth it.
Bug: 26871259
Change-Id: I46249838850ae32063eb5b7d08c731c5bb0fbf6b
This CL implements a TCP protocol for use with fastboot. Protocol
description is given in fastboot_protocol.txt, some examples of
expected behavior can also be found in tcp_test.cpp.
Usage is:
fastboot -s tcp:<hostname>[:port] <command>
Bug: http://b/26558551
Change-Id: If53a514a534489c617db32c4fea8819949121282
- collect st_rdev on open, or when required, for /dev/ashmem.
- check in all cases if fd is a character device and matches rdev.
- requires that we have open, read and write access to /dev/ashmem
to check, assumption being that if we can not, then we have no
right playing with the associated misdirected file descriptor.
NB: ashmem libcutil library entry points can no longer be called in
signal context.
Bug: 26871259
Change-Id: I9a17e33317a9be795131473a51c16f761b5f7407
Fixes SocketMock::ExpectSendFailure() to allow unit testing of errors
during send, and adds tests for ExpectSendFailure() and
AddReceiveFailure().
Also adds missing tests to make sure ReceiveAll() continues to read
until failure or all bytes have been read.
Bug: http://b/26157893
Change-Id: I67e7d6de8e8ec4a3b62a6b7d7217f7530862edf7
Fixes libcutils multi-buffer write interface to be more friendly and
hooks into it from the fastboot Socket class.
Bug: http://b/26558551
Change-Id: Ibb3a8428fc379755602de52722c1260f9e345bc0
and print a warning message containing the type
when the battery monitor fails to recognize a power supply.
Change-Id: I02ebd89736f7444f8bf7f28550afeec82d57e107