commit: 85c445dbc0d3526ff2df263f1d48dbc67433cd10 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Wed Jun 5 09:14:19 2019 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Wed Jun 5 09:14:19 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=85c445db
libq/atom: retain all input in atom_format_r Copy the remainder, as well as data before and inbetween expandos. Bug: https://bugs.gentoo.org/687416 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> libq/atom.c | 3 +-- qatom.c | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libq/atom.c b/libq/atom.c index 5627415..ae781a8 100644 --- a/libq/atom.c +++ b/libq/atom.c @@ -645,8 +645,7 @@ atom_format_r( while (*p != '\0') { fmt = strchr(p, '%'); if (fmt == NULL) { - if (buflen > 0) - *buf = '\0'; + append_buf(buf, buflen, "%s", p); return buf; } else if (fmt != p) { append_buf(buf, buflen, "%.*s", (int)(fmt - p), p); diff --git a/qatom.c b/qatom.c index 8825055..c7b6ccf 100644 --- a/qatom.c +++ b/qatom.c @@ -4,6 +4,7 @@ * * Copyright 2005-2008 Ned Ludd - <[email protected]> * Copyright 2005-2014 Mike Frysinger - <[email protected]> + * Copyright 2018- Fabian Groffen - <[email protected]> */ #include "main.h" @@ -41,9 +42,9 @@ int qatom_main(int argc, char **argv) while ((i = GETOPT_LONG(QATOM, qatom, "")) != -1) { switch (i) { - case 'F': format = optarg; break; + case 'F': format = optarg; break; case 'c': action = _COMPARE; break; - case 'p': action = _PRINT; break; + case 'p': action = _PRINT; break; COMMON_GETOPTS_CASES(qatom) } }
