debuggerd: use O_NOFOLLOW|O_CLOEXEC for tombstones
Change-Id: I71bdfba30346a9fad3129b404f39eda8190698e3
This commit is contained in:
parent
cadd5bb70e
commit
04f9b2a809
1 changed files with 2 additions and 2 deletions
4
debuggerd/tombstone.cpp
Executable file → Normal file
4
debuggerd/tombstone.cpp
Executable file → Normal file
|
|
@ -674,7 +674,7 @@ static char* find_and_open_tombstone(int* fd) {
|
|||
if (errno != ENOENT)
|
||||
continue;
|
||||
|
||||
*fd = open(path, O_CREAT | O_EXCL | O_WRONLY, 0600);
|
||||
*fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0600);
|
||||
if (*fd < 0)
|
||||
continue; // raced ?
|
||||
|
||||
|
|
@ -689,7 +689,7 @@ static char* find_and_open_tombstone(int* fd) {
|
|||
|
||||
// we didn't find an available file, so we clobber the oldest one
|
||||
snprintf(path, sizeof(path), TOMBSTONE_TEMPLATE, oldest);
|
||||
*fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
||||
*fd = open(path, O_CREAT | O_TRUNC | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0600);
|
||||
if (*fd < 0) {
|
||||
ALOGE("failed to open tombstone file '%s': %s\n", path, strerror(errno));
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue