fdisk: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-04-04 20:02:04 +02:00
parent 3862f68538
commit b2d28533dd
5 changed files with 11 additions and 0 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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]);

View File

@ -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);

View File

@ -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?"));