diff --git a/NEWS b/NEWS index 290e9b69dd92fe2868711687eb1fcc8e641cbec2..65128640ad51b24fe469bc1d16c3dfc83b2409a5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +0.8.4 (3/25/2012): +------------------ + +- REALLY fixed Ctrl+D problems! Now gdisk terminates upon receiving a + Ctrl+D. In all previous versions, it could lock itself into a CPU-hogging + loop if launched via "sudo" from a terminal window that was then closed + or if Ctrl+D was pressed at certain input prompts (for a partition name + or sector number, for instance). + 0.8.3 (3/23/2012): ------------------ diff --git a/basicmbr.cc b/basicmbr.cc index fd5f30a182221e82fdc7582da20930099880634a..74837341d5dabc0ea879992be422b852ad7a3cde 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -1532,7 +1532,7 @@ int BasicMBRData::DoMenu(const string& prompt) { cout << prompt; switch (ReadString()[0]) { case '\0': - goOn = !cin.eof(); + goOn = cin.good(); break; case 'a': case 'A': num = GetNumber(1, MAX_MBR_PARTS, 1, "Toggle active flag for partition: ") - 1; diff --git a/cgdisk.8 b/cgdisk.8 index 1ec7480c6afa737060abc4e967be605644f7a69e..45c51ff60ca64780959cfebdc728e9e9e10fbb66 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "CGDISK" "8" "0.8.3" "Roderick W. Smith" "GPT fdisk Manual" +.TH "CGDISK" "8" "0.8.4" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" cgdisk \- Curses-based GUID partition table (GPT) manipulator .SH "SYNOPSIS" @@ -268,7 +268,7 @@ Write data. Use this command to save your changes. .SH "BUGS" -As of March 2012 (version 0.8.3), \fBcgdisk\fR should be considered +As of March 2012 (version 0.8.4), \fBcgdisk\fR should be considered beta software. Although the underlying partition manipulation code is much older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk version 0.8.0. Known bugs and limitations include: diff --git a/current.spec b/current.spec index 42af3fbef49f37ee17b8eee3c9aea0c33f487f17..643692ebb99dd9d86efbf3a3d4dc5f16f540bc23 100644 --- a/current.spec +++ b/current.spec @@ -1,11 +1,11 @@ Summary: GPT partitioning and MBR repair software Name: gptfdisk -Version: 0.8.3 +Version: 0.8.4 Release: 1%{?dist} License: GPLv2 URL: http://www.rodsbooks.com/gdisk Group: Applications/System -Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.3.tar.gz +Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.4.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description @@ -80,5 +80,5 @@ provides a few additional partition manipulation features. %changelog -* Fri Mar 23 2012 R Smith <rodsmith@rodsbooks.com> - 0.8.3 -- Created spec file for 0.8.3 release +* Sun Mar 25 2012 R Smith <rodsmith@rodsbooks.com> - 0.8.4 +- Created spec file for 0.8.4 release diff --git a/diskio.h b/diskio.h index 310207764168f5764863380d9996088d25b3e002..5947e7d16df95bbea0eeab1fcee6fdab9ba6fb8e 100644 --- a/diskio.h +++ b/diskio.h @@ -74,6 +74,6 @@ class DiskIO { string GetName(void) const {return realFilename;} uint64_t DiskSize(int* err); -}; // struct GPTPart +}; // class DiskIO #endif diff --git a/fixparts.8 b/fixparts.8 index 5aa53287fb91362034d07002aaf5e201a6aa43d4..fc25df4fb520f20661749ac2aca0e24378f25b78 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -1,6 +1,6 @@ .\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "FIXPARTS" "8" "0.8.3" "Roderick W. Smith" "FixParts Manual" +.TH "FIXPARTS" "8" "0.8.4" "Roderick W. Smith" "FixParts Manual" .SH "NAME" fixparts \- MBR partition table repair utility .SH "SYNOPSIS" @@ -202,7 +202,7 @@ see a summary of available options. .PP .SH "BUGS" -As of March 2012 (version 0.8.3), \fBfixparts\fR +As of March 2012 (version 0.8.4), \fBfixparts\fR should be considered beta software. Known bugs and limitations include: .TP diff --git a/gdisk.8 b/gdisk.8 index 1447af1d9bd44fef863bd865833db8a2b69123ac..140a6b327d2c652775a3b2800e1a29a22f671ac3 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "GDISK" "8" "0.8.3" "Roderick W. Smith" "GPT fdisk Manual" +.TH "GDISK" "8" "0.8.4" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" gdisk \- Interactive GUID partition table (GPT) manipulator .SH "SYNOPSIS" @@ -561,7 +561,7 @@ entering data. When only one option is possible, \fBgdisk\fR usually bypasses the prompt entirely. .SH "BUGS" -As of March 2012 (version 0.8.3), \fBgdisk\fR +As of March 2012 (version 0.8.4), \fBgdisk\fR should be considered beta software. Known bugs and limitations include: .TP diff --git a/gpttext.cc b/gpttext.cc index 2f3035654e1cc915dee327cf597e74d7d8c7f564..506c0f1737d40fad917f38339bcc82c76d8fb761 100644 --- a/gpttext.cc +++ b/gpttext.cc @@ -25,6 +25,7 @@ #include <stdint.h> #include <limits.h> #include <iostream> +#include <fstream> #include <sstream> #include <cstdio> #include "attributes.h" @@ -509,12 +510,12 @@ void GPTDataTextUI::MainMenu(string filename) { int goOn = 1; PartType typeHelper; uint32_t temp1, temp2; - + do { cout << "\nCommand (? for help): "; switch (ReadString()[0]) { case '\0': - goOn = !cin.eof(); + goOn = cin.good(); break; case 'b': case 'B': cout << "Enter backup filename to save: "; @@ -610,7 +611,7 @@ void GPTDataTextUI::RecoveryMenu(string filename) { cout << "\nRecovery/transformation command (? for help): "; switch (ReadString()[0]) { case '\0': - goOn = !cin.eof(); + goOn = cin.good(); break; case 'b': case 'B': RebuildMainHeader(); @@ -736,6 +737,7 @@ void GPTDataTextUI::ExpertsMenu(string filename) { cout << "\nExpert command (? for help): "; switch (ReadString()[0]) { case '\0': + goOn = cin.good(); break; case 'a': case 'A': if (GetPartRange(&temp1, &temp2) > 0) diff --git a/sgdisk.8 b/sgdisk.8 index ac2879f5a6ff21fdccdc0c45da8df9a06020e3bd..d9ae7e8f5239f0eabb87c24123bc82331d1077fd 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "SGDISK" "8" "0.8.3" "Roderick W. Smith" "GPT fdisk Manual" +.TH "SGDISK" "8" "0.8.4" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix .SH "SYNOPSIS" @@ -480,12 +480,17 @@ Non\-GPT disk detected and no \fI\-g\fR option .B 4 An error prevented saving changes +.TP +.B 5 +An error occurred while reading standard input (should never occur with +sgdisk, but may with gdisk) + .TP .B 8 Disk replication operation (-R) failed .SH "BUGS" -As of March 2012 (version 0.8.3), \fBsgdisk\fR +As of March 2012 (version 0.8.4), \fBsgdisk\fR should be considered beta software. Known bugs and limitations include: .TP diff --git a/support.cc b/support.cc index 0a311a6801c0efffaebc758e057aaa751939e374..9e1c7994198eecc3bddaa8b79095e79a1e3676dd 100644 --- a/support.cc +++ b/support.cc @@ -38,8 +38,8 @@ string ReadString(void) { string inString; getline(cin, inString); - if (!cin) - cin.clear(); + if (!cin.good()) + exit(5); return inString; } // ReadString() @@ -56,6 +56,8 @@ int GetNumber(int low, int high, int def, const string & prompt) { do { cout << prompt; cin.getline(line, 255); + if (!cin.good()) + exit(5); num = sscanf(line, "%d", &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) @@ -100,6 +102,8 @@ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, do { cout << prompt; cin.getline(line, 255); + if (!cin.good()) + exit(5); response = IeeeToInt(line, sSize, low, high, def); } while ((response < low) || (response > high)); return response; diff --git a/support.h b/support.h index 934908c5ca409d71d15beb11cb98f25f1bd15538..cbf8c32898a9d7fadcfb932a1d6fbd6b16de04c6 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "0.8.3" +#define GPTFDISK_VERSION "0.8.4" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64