Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c182cde2 authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "Open /data/anr/traces.txt with O_APPEND." am: 5bf85401 am: 0b9df3a0

am: ade5ac01

Change-Id: I4e12124359c7f98de151951b14cc3de59cf09c1d
parents 145e5c1d ade5ac01
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -1021,17 +1021,13 @@ static void android_os_Debug_dumpNativeBacktraceToFileTimeout(JNIEnv* env, jobje
        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) {
        fprintf(stderr, "Can't open %s: %s\n", fileName8.string(), strerror(errno));
        return;
    }

    if (lseek(fd, 0, SEEK_END) < 0) {
        fprintf(stderr, "lseek: %s\n", strerror(errno));
    } else {
    dump_backtrace_to_file_timeout(pid, fd, timeoutSecs);
    }

    close(fd);
}