From 2e5cc7508a9bfa1010def62ebf5b72cf7bf78927 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Thu, 18 Nov 2021 12:21:24 +0100 Subject: [PATCH] Linux (as root): FAT32 format: wait for FAT partition after sfdisk The FAT partition /dev node is supposed to be already available after running partprobe, but since there is a user report that is not always the case, double check and delay if necessary. Closes #237 --- driveformatthread.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/driveformatthread.cpp b/driveformatthread.cpp index bf34d03..67ca49b 100644 --- a/driveformatthread.cpp +++ b/driveformatthread.cpp @@ -187,6 +187,18 @@ void DriveFormatThread::run() } proc.execute("partprobe", QStringList() ); + for (int tries = 0; tries < 30; tries++) + { + if (QFile::exists(fatpartition)) + break; + + QThread::msleep(100); + } + if (!QFile::exists(fatpartition)) + { + emit error(tr("Partitioning did not create expected FAT partition %1").arg(QString(fatpartition))); + return; + } args.clear(); args << fatpartition;