From 0b4b25416f396e97f5631ba5b055327a7e0461a9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 22 Oct 2009 09:39:53 +0200 Subject: [PATCH 2/3] =?utf-8?q?Bug=2024673=20=E2=80=93=20support=20creating=20swap=20fs=20with=20labels?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit mkswapfs supports labels just fine, add support for it to FilesystemCreate(). https://bugs.freedesktop.org/show_bug.cgi?id=24673 --- src/job-mkfs.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/job-mkfs.c b/src/job-mkfs.c index 9a4d428..50a13b4 100644 --- a/src/job-mkfs.c +++ b/src/job-mkfs.c @@ -218,8 +218,19 @@ main (int argc, char **argv) s = g_string_new ("mkswap"); for (n = 0; options[n] != NULL; n++) { - g_printerr ("option %s not supported\n", options[n]); - goto out; + if (g_str_has_prefix (options[n], "label=")) { + label = strdup (options[n] + sizeof ("label=") - 1); + if (!validate_and_escape_label (&label, 12)) { + g_string_free (s, TRUE); + goto out; + } + g_string_append_printf (s, " -L \"%s\"", label); + g_free (label); + label = NULL; + } else { + g_printerr ("option %s not supported\n", options[n]); + goto out; + } } g_string_append_printf (s, " %s", device); command_line = g_string_free (s, FALSE); -- 1.6.3.3