From: Karel Zak Date: Wed, 4 Jul 2018 12:06:38 +0000 (+0200) Subject: libfdisk: use \x to read/write partition name X-Git-Tag: v2.33-rc1~144 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=810b313688d2727447414098112a9aa73d2f93be;p=thirdparty%2Futil-linux.git libfdisk: use \x to read/write partition name Addresses: https://github.com/karelzak/util-linux/issues/656 Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index 02ee7876ca..1970e7b66f 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 */