summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2013-05-24 09:03:17 +0200
committerMartin Pitt <martinpitt@gnome.org>2013-11-25 08:05:15 +0100
commit306b56b712b2d2cf4884a6c07f4ee4618702d550 (patch)
treed6aa9b568e39ea7ce84ec93c32d6861576bf76b6 /src
parentbc5e358e4ad686a00e8df29a42aabb6332000d98 (diff)
Use dosfstools instead of mtools
We already require dosfstools for mkfs.vfat, so just also use it for changing the fs label. https://bugs.freedesktop.org/show_bug.cgi?id=52332 Co-Authored-By: Martin Pitt <martin.pitt@ubuntu.com>
Diffstat (limited to 'src')
-rw-r--r--src/udiskslinuxfilesystem.c13
-rw-r--r--src/udiskslinuxfsinfo.c4
2 files changed, 13 insertions, 4 deletions
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
index e87e272..31a5475 100644
--- a/src/udiskslinuxfilesystem.c
+++ b/src/udiskslinuxfilesystem.c
@@ -1819,6 +1819,7 @@ handle_set_label (UDisksFilesystem *filesystem,
UDisksBaseJob *job;
const gchar *action_id;
const gchar *message;
+ gchar *real_label = NULL;
uid_t caller_uid;
gid_t caller_gid;
pid_t caller_pid;
@@ -1893,8 +1894,9 @@ handle_set_label (UDisksFilesystem *filesystem,
goto out;
}
- /* VFAT does not allow some characters; as mlabel hangs with interactive
- * question in this case, check in advance */
+ /* VFAT does not allow some characters; as dosfslabel does not enforce this,
+ * check in advance; also, VFAT only knows upper-case characters, dosfslabel
+ * enforces this */
if (g_strcmp0 (probed_fs_type, "vfat") == 0)
{
const gchar *forbidden = "\"*/:<>?\\|";
@@ -1911,6 +1913,11 @@ handle_set_label (UDisksFilesystem *filesystem,
goto out;
}
}
+
+ /* we need to remember that we make a copy, so assign it to a new
+ * variable, too */
+ real_label = g_ascii_strup (label, -1);
+ label = real_label;
}
/* Fail if the device is already mounted and the tools/drivers doesn't
@@ -1988,6 +1995,8 @@ handle_set_label (UDisksFilesystem *filesystem,
invocation);
out:
+ /* for some FSes we need to copy and modify label; free our copy */
+ g_free (real_label);
g_free (command);
g_clear_object (&object);
return TRUE; /* returning TRUE means that we handled the method invocation */
diff --git a/src/udiskslinuxfsinfo.c b/src/udiskslinuxfsinfo.c
index 6cb623e..0a12208 100644
--- a/src/udiskslinuxfsinfo.c
+++ b/src/udiskslinuxfsinfo.c
@@ -53,8 +53,8 @@ const FSInfo _fs_info[] =
},
{
"vfat",
- "mlabel -i $DEVICE ::$LABEL",
- "mlabel -i $DEVICE -c ::",
+ "dosfslabel $DEVICE $LABEL",
+ NULL,
FALSE, /* supports_online_label_rename */
FALSE, /* supports_owners */
"mkfs.vfat -I -n $LABEL $DEVICE",