[gparted] Correctly report usage of absolutely full NTFS (#697946)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Correctly report usage of absolutely full NTFS (#697946)
- Date: Wed, 17 Apr 2013 17:17:38 +0000 (UTC)
commit 50ca2e5f135da759748e7298cc1ad40160441597
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Apr 13 12:34:06 2013 +0100
Correctly report usage of absolutely full NTFS (#697946)
For an absolutely full NTFS GParted doesn't show the file system usage
but instead shows a warning against the partition.
GParted was looking only for "resize at %d" to determine file system
used figure in the output from the ntfsresize command. Also handle
finding "ERROR: Volume is full" too to derive used figure.
NTFS with 1 block free case:
# ntfsresize --info --force --no-progress-bar /dev/sda9
...
Current volume size: 1073738240 bytes (1074 MB)
...
Collecting resizing constraints ...
You might resize at 1073737728 bytes (freeing 4096 bytes).
...
# echo $?
0
Absolutely full NTFS case:
# ntfsresize --info --force --no-progress-bar /dev/sda9
...
Current volume size: 1073738240 bytes (1074 MB)
...
Collecting resizing constraints ...
ERROR: Volume is full. To shrink it, delete unused files.
# echo $?
1
Closes Bug #697946 - Absolutely full NTFS reported as partition error
src/ntfs.cc | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/ntfs.cc b/src/ntfs.cc
index 033eaf7..3a160af 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -110,8 +110,9 @@ FS ntfs::get_filesystem_support()
void ntfs::set_used_sectors( Partition & partition )
{
- if ( ! Utils::execute_command(
- "ntfsresize --info --force --no-progress-bar " + partition .get_path(), output, error, true )
)
+ exit_status = Utils::execute_command(
+ "ntfsresize --info --force --no-progress-bar " + partition .get_path(), output, error, true )
;
+ if ( exit_status == 0 || exit_status == 1<<8 )
{
index = output .find( "Current volume size:" ) ;
if ( index >= output .length() ||
@@ -122,6 +123,11 @@ void ntfs::set_used_sectors( Partition & partition )
if ( index >= output .length() ||
sscanf( output .substr( index ) .c_str(), "resize at %Ld", &N ) != 1 )
N = -1 ;
+ //For an absolutely full NTFS, "ntfsresize --info" exits
+ // with status 1 and reports this message instead
+ index = output .find( "ERROR: Volume is full" ) ;
+ if ( index < output .length() )
+ N = T ;
if ( T > -1 && N > -1 )
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]