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

Commit 4834e453 authored by Jamie Gennis's avatar Jamie Gennis Committed by Android Git Automerger
Browse files

am 0fa7ac9b: am 43122e7e: atrace: use creat instead of truncate

* commit '0fa7ac9b':
  atrace: use creat instead of truncate
parents 905c2d7a 0fa7ac9b
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -176,13 +176,18 @@ static bool fileIsWritable(const char* filename) {
// Truncate a file.
static bool truncateFile(const char* path)
{
    int err = truncate(path, 0);
    if (err != 0) {
    // This uses creat rather than truncate because some of the debug kernel
    // device nodes (e.g. k_ftraceFilterPath) currently aren't changed by
    // calls to truncate, but they are cleared by calls to creat.
    int traceFD = creat(path, 0);
    if (traceFD == -1) {
        fprintf(stderr, "error truncating %s: %s (%d)\n", path,
            strerror(errno), errno);
        return false;
    }

    close(traceFD);

    return true;
}