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

Commit d3297c2b authored by JP Abgrall's avatar JP Abgrall Committed by Android (Google) Code Review
Browse files

Merge "logwrap lib: make logwrapper less verbose when told to not log"

parents 080427e4 a689d13a
Loading
Loading
Loading
Loading
+23 −20
Original line number Diff line number Diff line
@@ -144,22 +144,26 @@ static int parent(const char *tag, int parent_read, int signal_fd, pid_t pid,
        }
    }

    if (chld_sts != NULL) {
        *chld_sts = status;
    } else {
      if (WIFEXITED(status))
        rc = WEXITSTATUS(status);
      else
        rc = -ECHILD;
    }

    if (logwrap) {
      // Flush remaining data
      if (a != b) {
        buffer[b] = '\0';
        if (logwrap)
        ALOG(LOG_INFO, btag, "%s", &buffer[a]);
      }

      if (WIFEXITED(status)) {
        if (WEXITSTATUS(status))
          ALOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", btag,
               WEXITSTATUS(status));
        if (chld_sts == NULL)
            rc = WEXITSTATUS(status);
      } else {
        if (chld_sts == NULL)
            rc = -ECHILD;
        if (WIFSIGNALED(status))
          ALOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", btag,
               WTERMSIG(status));
@@ -167,8 +171,7 @@ static int parent(const char *tag, int parent_read, int signal_fd, pid_t pid,
          ALOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", btag,
               WSTOPSIG(status));
      }
    if (chld_sts != NULL)
        *chld_sts = status;
    }

err_poll:
    return rc;