aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu2017-01-30 18:48:52 -0600
committerTianjie Xu2017-02-03 14:35:40 -0600
commitab1abae59ccca2b5f1685ab7d279a0273ff9278b (patch)
tree709a00dd6f56179036bc6203ed52feb093969346 /install.cpp
parent56ff8061b1bc58cf646a14054485b617e916f423 (diff)
downloadplatform-bootable-recovery-ab1abae59ccca2b5f1685ab7d279a0273ff9278b.tar.gz
platform-bootable-recovery-ab1abae59ccca2b5f1685ab7d279a0273ff9278b.tar.xz
platform-bootable-recovery-ab1abae59ccca2b5f1685ab7d279a0273ff9278b.zip
Avoid to call UI functions in child process
ui_print uses a mutex to protect the critical section. And a forked child process may intialize the mutex inappropriatly, which leads to a hanging child process. So we shall avoid to call the UI functions in child process. Bug: 34769056 Test: fake ota on fugu failed as expected due to updater format mismatch. Change-Id: I81bc942a796878fac19cf712512092c2b0d807c9
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/install.cpp b/install.cpp
index 959a7422..91e4875c 100644
--- a/install.cpp
+++ b/install.cpp
@@ -382,7 +382,11 @@ static int try_update_binary(const char* path, ZipArchiveHandle zip, bool* wipe_
382 umask(022); 382 umask(022);
383 close(pipefd[0]); 383 close(pipefd[0]);
384 execv(chr_args[0], const_cast<char**>(chr_args)); 384 execv(chr_args[0], const_cast<char**>(chr_args));
385 PLOG(ERROR) << "Can't run " << chr_args[0]; 385 // Bug: 34769056
386 // We shouldn't use LOG/PLOG in the forked process, since they may cause
387 // the child process to hang. This deadlock results from an improperly
388 // copied mutex in the ui functions.
389 fprintf(stdout, "E:Can't run %s (%s)\n", chr_args[0], strerror(errno));
386 _exit(-1); 390 _exit(-1);
387 } 391 }
388 close(pipefd[1]); 392 close(pipefd[1]);