diff options
author | Karel Zak | 2018-07-04 14:06:38 +0200 |
---|---|---|
committer | Karel Zak | 2018-07-04 14:09:16 +0200 |
commit | 810b313688d2727447414098112a9aa73d2f93be (patch) | |
tree | 95b4182205319f13bc1693155b416e3328805b84 /libfdisk | |
parent | fallocate: remove unwanted debug message (diff) | |
download | kernel-qcow2-util-linux-810b313688d2727447414098112a9aa73d2f93be.tar.gz kernel-qcow2-util-linux-810b313688d2727447414098112a9aa73d2f93be.tar.xz kernel-qcow2-util-linux-810b313688d2727447414098112a9aa73d2f93be.zip |
libfdisk: use \x<hex> to read/write partition name
Addresses: https://github.com/karelzak/util-linux/issues/656
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/script.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index 02ee7876c..1970e7b66 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -2,6 +2,7 @@ #include "fdiskP.h" #include "strutils.h" #include "carefulputc.h" +#include "mangle.h" /** * SECTION: script @@ -676,8 +677,10 @@ static int write_file_sfdisk(struct fdisk_script *dp, FILE *f) if (pa->uuid) fprintf(f, ", uuid=%s", pa->uuid); - if (pa->name && *pa->name) - fprintf(f, ", name=\"%s\"", pa->name); + if (pa->name && *pa->name) { + fputs(", name=", f); + fputs_quoted(pa->name, f); + } /* for MBR attr=80 means bootable */ if (pa->attrs) { @@ -974,6 +977,7 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s) } else if (!strncasecmp(p, "name=", 5)) { p += 5; rc = next_string(&p, &pa->name); + unhexmangle_string(pa->name); } else if (!strncasecmp(p, "type=", 5) || !strncasecmp(p, "Id=", 3)) { /* backward compatibility */ |