Merge "Open /data/anr/traces.txt with O_APPEND." am: 5bf8540194
am: 0b9df3a012
Change-Id: I2cc15a9391c8b7a1e8bd1af7d20db684ff95a6f4
This commit is contained in:
@@ -1027,17 +1027,13 @@ static void android_os_Debug_dumpNativeBacktraceToFileTimeout(JNIEnv* env, jobje
|
|||||||
env->ReleaseStringCritical(fileName, str);
|
env->ReleaseStringCritical(fileName, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd = open(fileName8.string(), O_CREAT | O_WRONLY | O_NOFOLLOW, 0666); /* -rw-rw-rw- */
|
int fd = open(fileName8.string(), O_CREAT | O_WRONLY | O_NOFOLLOW | O_CLOEXEC | O_APPEND, 0666);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, "Can't open %s: %s\n", fileName8.string(), strerror(errno));
|
fprintf(stderr, "Can't open %s: %s\n", fileName8.string(), strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lseek(fd, 0, SEEK_END) < 0) {
|
dump_backtrace_to_file_timeout(pid, fd, timeoutSecs);
|
||||||
fprintf(stderr, "lseek: %s\n", strerror(errno));
|
|
||||||
} else {
|
|
||||||
dump_backtrace_to_file_timeout(pid, fd, timeoutSecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user