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

Commit b7a0166b authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

liblog: deal with warning messages

(cherry pick from commit b525884e)

- Fix bug in fake_log_devices when it can not allocate memory
  failing to use the full on-stack buffer as backup.
- remove superfluous code.

Bug: 27265662
Change-Id: I97b6cca5f4ce8ecad9beb3a08353de596d6a4ad1
parent a9061ece
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -470,8 +470,8 @@ static void showLog(LogState *state,
        vec = (struct iovec*)malloc(sizeof(struct iovec)*numVecs);
        vec = (struct iovec*)malloc(sizeof(struct iovec)*numVecs);
        if (vec == NULL) {
        if (vec == NULL) {
            msg = "LOG: write failed, no memory";
            msg = "LOG: write failed, no memory";
            numVecs = 3;
            numVecs = INLINE_VECS;
            numLines = 1;
            numLines = numVecs / 3;
            vec = stackVec;
            vec = stackVec;
        }
        }
    }
    }
+1 −7
Original line number Original line Diff line number Diff line
@@ -503,10 +503,7 @@ ssize_t android_logger_get_statistics(struct logger_list *logger_list,
    }
    }


    if (logger_list->pid) {
    if (logger_list->pid) {
        n = snprintf(cp, remaining, " pid=%u", logger_list->pid);
        snprintf(cp, remaining, " pid=%u", logger_list->pid);
        n = min(n, remaining);
        remaining -= n;
        cp += n;
    }
    }


    return send_log_msg(NULL, NULL, buf, len);
    return send_log_msg(NULL, NULL, buf, len);
@@ -657,7 +654,6 @@ static int android_logger_list_read_pstore(struct logger_list *logger_list,
        preread_count = 0;
        preread_count = 0;
    }
    }


    ret = 0;
    while(1) {
    while(1) {
        if (preread_count < sizeof(buf)) {
        if (preread_count < sizeof(buf)) {
            ret = TEMP_FAILURE_RETRY(read(logger_list->sock,
            ret = TEMP_FAILURE_RETRY(read(logger_list->sock,
@@ -834,7 +830,6 @@ int android_logger_list_read(struct logger_list *logger_list,
        if (logger_list->pid) {
        if (logger_list->pid) {
            ret = snprintf(cp, remaining, " pid=%u", logger_list->pid);
            ret = snprintf(cp, remaining, " pid=%u", logger_list->pid);
            ret = min(ret, remaining);
            ret = min(ret, remaining);
            remaining -= ret;
            cp += ret;
            cp += ret;
        }
        }


@@ -867,7 +862,6 @@ int android_logger_list_read(struct logger_list *logger_list,
        logger_list->sock = sock;
        logger_list->sock = sock;
    }
    }


    ret = 0;
    while(1) {
    while(1) {
        memset(log_msg, 0, sizeof(*log_msg));
        memset(log_msg, 0, sizeof(*log_msg));