[gparted] Check usability of named device following a non-existent / invalid one (#756434)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Check usability of named device following a non-existent / invalid one (#756434)
- Date: Thu, 15 Oct 2015 16:19:22 +0000 (UTC)
commit 9d6ebb3dabafc7bfb0105bb5758e04a5efe85e6f
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Wed Oct 14 17:51:38 2015 +0100
Check usability of named device following a non-existent / invalid one (#756434)
When multiple devices are named on the command line and (after sorting
and removing duplicates) the device following a non-existent or invalid
one is not checked for usability [1]. In most situations this isn't
noticed as the device gets skipped at the "Searching ... partitions"
step instead. However as seen in bug 755495 and commit [2]
checking usability matters.
For example (on CentOS 6.5) a large sector disk device can be edited
when it follows a non-existent or invalid device named on the command
line:
# modprobe scsi_debug dev_size_mb=128 sector_size=4096
# fgrep scsi_debug /sys/block/*/device/model
/sys/block/sdd/device/model:scsi_debug
# ./gpartedbin /dev/does-not-exist /dev/sdd
======================
libparted : 2.1
======================
Could not stat device /dev/does-not-exist - No such file or directory.
Device /dev/sdd has a logical sector size of 4096. Not all parts of GNU Parted support this at the
moment, and the working code is HIGHLY EXPERIMENTAL.
/dev/sdd: unrecognised disk label
When erasing a device don't skip confirming the following device is
usable.
[1] Usable device as implemented by useable_device()
Must not have a large sector size when GParted is built with an old
version of libparted which doesn't support large sector sizes and
must be able to read the first sector.
[2] 362b2db331b4c31a978bb67232fa7f3ce9ab38c3
Check disks named on the command line are safe to use too (#755495)
Bug 756434 - GParted dumps core when passing non-existent or invalid
device on the command line
src/GParted_Core.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 8f6be31..ee97efa 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -255,7 +255,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
if ( lp_device == NULL || ! useable_device( lp_device ) )
{
// Remove this disk device which isn't useable
- device_paths.erase( device_paths.begin() + t );
+ device_paths.erase( device_paths.begin() + t-- );
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]