1 |
commit: 85c445dbc0d3526ff2df263f1d48dbc67433cd10 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 5 09:14:19 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 5 09:14:19 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=85c445db |
7 |
|
8 |
libq/atom: retain all input in atom_format_r |
9 |
|
10 |
Copy the remainder, as well as data before and inbetween expandos. |
11 |
|
12 |
Bug: https://bugs.gentoo.org/687416 |
13 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
14 |
|
15 |
libq/atom.c | 3 +-- |
16 |
qatom.c | 5 +++-- |
17 |
2 files changed, 4 insertions(+), 4 deletions(-) |
18 |
|
19 |
diff --git a/libq/atom.c b/libq/atom.c |
20 |
index 5627415..ae781a8 100644 |
21 |
--- a/libq/atom.c |
22 |
+++ b/libq/atom.c |
23 |
@@ -645,8 +645,7 @@ atom_format_r( |
24 |
while (*p != '\0') { |
25 |
fmt = strchr(p, '%'); |
26 |
if (fmt == NULL) { |
27 |
- if (buflen > 0) |
28 |
- *buf = '\0'; |
29 |
+ append_buf(buf, buflen, "%s", p); |
30 |
return buf; |
31 |
} else if (fmt != p) { |
32 |
append_buf(buf, buflen, "%.*s", (int)(fmt - p), p); |
33 |
|
34 |
diff --git a/qatom.c b/qatom.c |
35 |
index 8825055..c7b6ccf 100644 |
36 |
--- a/qatom.c |
37 |
+++ b/qatom.c |
38 |
@@ -4,6 +4,7 @@ |
39 |
* |
40 |
* Copyright 2005-2008 Ned Ludd - <solar@g.o> |
41 |
* Copyright 2005-2014 Mike Frysinger - <vapier@g.o> |
42 |
+ * Copyright 2018- Fabian Groffen - <grobian@g.o> |
43 |
*/ |
44 |
|
45 |
#include "main.h" |
46 |
@@ -41,9 +42,9 @@ int qatom_main(int argc, char **argv) |
47 |
|
48 |
while ((i = GETOPT_LONG(QATOM, qatom, "")) != -1) { |
49 |
switch (i) { |
50 |
- case 'F': format = optarg; break; |
51 |
+ case 'F': format = optarg; break; |
52 |
case 'c': action = _COMPARE; break; |
53 |
- case 'p': action = _PRINT; break; |
54 |
+ case 'p': action = _PRINT; break; |
55 |
COMMON_GETOPTS_CASES(qatom) |
56 |
} |
57 |
} |