|
|
|
[PATCH 1/6] fdisk: add an quit/exit handling function | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
From: Davidlohr Bueso <dave@xxxxxxx>
Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
---
fdisk/fdisk.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 3f83297..2f3c119 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1810,6 +1810,13 @@ move_begin(int i) {
}
}
+static void __attribute__ ((__noreturn__)) handle_quit(void)
+{
+ close(fd);
+ printf("\n");
+ exit(EXIT_SUCCESS);
+}
+
static void
expert_command_prompt(void)
{
@@ -1875,9 +1882,7 @@ expert_command_prompt(void)
x_list_table(0);
break;
case 'q':
- close(fd);
- printf("\n");
- exit(0);
+ handle_quit();
case 'r':
return;
case 's':
@@ -2064,9 +2069,7 @@ static void command_prompt(void)
list_table(0);
break;
case 'q':
- close(fd);
- printf("\n");
- exit(0);
+ handle_quit();
case 's':
create_sunlabel();
break;
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Site Home] [Netdev] [Ethernet Bridging] [Linux Wireless] [Kernel Newbies] [Memory] [Security] [Linux for Hams] [Netfilter] [Bugtraq] [Rubini] [Photo] [Yosemite] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux RAID] [Linux Admin] [Samba] [Video 4 Linux] [Linux Resources]