summaryrefslogtreecommitdiffstats
path: root/fdisk
diff options
context:
space:
mode:
authorSami Kerola2012-04-04 20:02:04 +0200
committerSami Kerola2012-04-04 20:02:04 +0200
commitb2d28533ddd536f32dc18097524af3498cc0ebf0 (patch)
treef7182b5efc7ce9a49c4fab84dad2d27aa5a42dd9 /fdisk
parentgetopt: verify writing to streams was successful (diff)
downloadkernel-qcow2-util-linux-b2d28533ddd536f32dc18097524af3498cc0ebf0.tar.gz
kernel-qcow2-util-linux-b2d28533ddd536f32dc18097524af3498cc0ebf0.tar.xz
kernel-qcow2-util-linux-b2d28533ddd536f32dc18097524af3498cc0ebf0.zip
fdisk: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'fdisk')
-rw-r--r--fdisk/cfdisk.c2
-rw-r--r--fdisk/fdisk.c2
-rw-r--r--fdisk/gpt.c2
-rw-r--r--fdisk/partitiontype.c3
-rw-r--r--fdisk/sfdisk.c2
5 files changed, 11 insertions, 0 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index a128ed757..a6cf01e5c 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -97,6 +97,7 @@
#include <wctype.h>
#endif
+#include "closestream.h"
#include "nls.h"
#include "rpmatch.h"
#include "blkdev.h"
@@ -2767,6 +2768,7 @@ main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((c = getopt(argc, argv, "ac:gh:s:vzP:")) != -1)
switch (c) {
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 8893a0174..4fc347b1f 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -33,6 +33,7 @@
#include "pathnames.h"
#include "canonicalize.h"
#include "strutils.h"
+#include "closestream.h"
#include "fdisksunlabel.h"
#include "fdisksgilabel.h"
@@ -2958,6 +2959,7 @@ main(int argc, char **argv) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((c = getopt(argc, argv, "b:c::C:hH:lsS:u::vV")) != -1) {
switch (c) {
diff --git a/fdisk/gpt.c b/fdisk/gpt.c
index aeacd6624..bb6911a21 100644
--- a/fdisk/gpt.c
+++ b/fdisk/gpt.c
@@ -39,6 +39,7 @@
#include "gpt.h"
#include "blkdev.h"
#include "bitops.h"
+#include "closestream.h"
#define GPT_HEADER_SIGNATURE 0x5452415020494645LL
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
@@ -202,6 +203,7 @@ gpt_probe_signature_devname(char *devname)
int
main(int argc, char **argv)
{
+ atexit(close_stdout);
if (argc!=2)
{
fprintf(stderr, "usage: %s <dev>\n", argv[0]);
diff --git a/fdisk/partitiontype.c b/fdisk/partitiontype.c
index 0ee44a0ba..02a22a595 100644
--- a/fdisk/partitiontype.c
+++ b/fdisk/partitiontype.c
@@ -10,6 +10,8 @@
#include <fcntl.h>
#include <stdlib.h>
+#include "closestream.h"
+
struct aix_label {
unsigned int magic;
/* more ... */
@@ -53,6 +55,7 @@ main(int argc, char **argv) {
struct sgi_label *psgi;
struct sun_label *psun;
+ atexit(close_stdout);
if (argc != 2) {
fprintf(stderr, "call: %s device\n", argv[0]);
exit(1);
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index a090772a8..f0ce08bcb 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -54,6 +54,7 @@
#include "pathnames.h"
#include "canonicalize.h"
#include "rpmatch.h"
+#include "closestream.h"
/*
* Table of contents:
@@ -2572,6 +2573,7 @@ main(int argc, char **argv) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
if (argc < 1)
errx(EXIT_FAILURE, _("no command?"));