summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-03-13 15:57:11 -0700
committerMark Salyzyn <salyzyn@google.com>2015-03-18 23:43:42 +0000
commit31f7df5fd1016ccfdec6ba9d65cd296861b2c40f (patch)
tree3f8053be82a1e523f46b9d7e20aa1a6c8663fb37 /liblog
parent928cbdd2c34cd5db9b344e593866f9e1e1e477e2 (diff)
downloadcore-31f7df5fd1016ccfdec6ba9d65cd296861b2c40f.tar.gz
core-31f7df5fd1016ccfdec6ba9d65cd296861b2c40f.tar.bz2
core-31f7df5fd1016ccfdec6ba9d65cd296861b2c40f.zip
liblog: reject empty logging messages
A regression after "liblog: Instrument logging of logd write drops" where an empty payload would result in an insufficient iovec to report the write drop. Change-Id: Iffabcfbb0680898d7a42004700e638e9d940ff5f
Diffstat (limited to 'liblog')
-rw-r--r--liblog/logd_write.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/liblog/logd_write.c b/liblog/logd_write.c
index a8650938f..8f8cc3fd5 100644
--- a/liblog/logd_write.c
+++ b/liblog/logd_write.c
@@ -178,6 +178,10 @@ static int __write_to_log_daemon(log_id_t log_id, struct iovec *vec, size_t nr)
static pid_t last_pid = (pid_t) -1;
static atomic_int_fast32_t dropped;
+ if (!nr) {
+ return -EINVAL;
+ }
+
if (last_uid == AID_ROOT) { /* have we called to get the UID yet? */
last_uid = getuid();
}