diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2020-07-08 11:38:59 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2020-07-08 11:38:59 +0200 |
| commit | faa2fd7cbad4609d06d7904c0a80cf2f8cd23678 (patch) | |
| tree | 3a5bfcc8879b719aec97cb73ed6e020cde502546 /fs/proc/bootconfig.c | |
| parent | 01e377c539ca52a6c753d0fdbe93b3b8fcd66a1c (diff) | |
| parent | ce3614daabea8a2d01c1dd17ae41d1ec5e5ae7db (diff) | |
Merge branch 'sched/urgent'
Diffstat (limited to 'fs/proc/bootconfig.c')
| -rw-r--r-- | fs/proc/bootconfig.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c index 9955d75c0585..ad31ec4ad627 100644 --- a/fs/proc/bootconfig.c +++ b/fs/proc/bootconfig.c @@ -26,8 +26,9 @@ static int boot_config_proc_show(struct seq_file *m, void *v) static int __init copy_xbc_key_value_list(char *dst, size_t size) { struct xbc_node *leaf, *vnode; - const char *val; char *key, *end = dst + size; + const char *val; + char q; int ret = 0; key = kzalloc(XBC_KEYLEN_MAX, GFP_KERNEL); @@ -41,16 +42,20 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) break; dst += ret; vnode = xbc_node_get_child(leaf); - if (vnode && xbc_node_is_array(vnode)) { + if (vnode) { xbc_array_for_each_value(vnode, val) { - ret = snprintf(dst, rest(dst, end), "\"%s\"%s", - val, vnode->next ? ", " : "\n"); + if (strchr(val, '"')) + q = '\''; + else + q = '"'; + ret = snprintf(dst, rest(dst, end), "%c%s%c%s", + q, val, q, vnode->next ? ", " : "\n"); if (ret < 0) goto out; dst += ret; } } else { - ret = snprintf(dst, rest(dst, end), "\"%s\"\n", val); + ret = snprintf(dst, rest(dst, end), "\"\"\n"); if (ret < 0) break; dst += ret; |
