Allow setting empty FAT label.

This breaks compatibility with dosfstools 4.1

BUG: 453388
This commit is contained in:
Andrius Štikonas 2022-05-15 23:20:25 +01:00
parent 6204041935
commit fd4a330887
1 changed files with 2 additions and 3 deletions

View File

@ -140,9 +140,8 @@ bool fat12::writeLabel(Report& report, const QString& deviceNode, const QString&
{
report.line() << xi18nc("@info:progress", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel.toUpper());
// This is needed to support new dosfstool 4.2. Later we can drop dosfstools 4.1 and add -r flag.
const QString label = newLabel.isEmpty() ? QStringLiteral("NO_LABEL") : newLabel;
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, label.toUpper() });
const QString label = newLabel.isEmpty() ? QStringLiteral("-r") : newLabel.toUpper();
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, label });
return cmd.run(-1) && cmd.exitCode() == 0;
}