#include <sys/types.h>
#include <sys/stat.h>
#include <getopt.h>
+
+#include "closestream.h"
#include "nls.h"
#include "c.h"
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
static const struct option longopts[] = {
{ "verbose", no_argument, 0, 'v' },
#include <locale.h>
#include <stddef.h>
+#include "closestream.h"
#include "nls.h"
#include "c.h"
setlocale(LC_NUMERIC, "C"); /* see comment above */
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((ch = getopt_long(argc, argv, "ac:efqt::Vh", longopts, NULL)) != -1)
switch(ch) {
}
doinput();
- fclose(timingfd);
+ if (close_stream(timingfd) != 0)
+ errx(EXIT_FAILURE, _("write error"));
return EXIT_SUCCESS;
}
ssize_t cc;
char ibuf[BUFSIZ];
- fclose(fscript);
+ if (close_stream(fscript) != 0)
+ errx(EXIT_FAILURE, _("write error"));
while (die == 0) {
if ((cc = read(STDIN_FILENO, ibuf, BUFSIZ)) > 0) {
if (flgs)
fcntl(master, F_SETFL, flgs);
+ if (close_stream(timingfd) != 0)
+ errx(EXIT_FAILURE, _("write error"));
done();
}
getslave();
close(master);
- fclose(fscript);
+ if (close_stream(fscript) != 0)
+ errx(EXIT_FAILURE, _("write error"));
dup2(slave, STDIN_FILENO);
dup2(slave, STDOUT_FILENO);
dup2(slave, STDERR_FILENO);
my_strftime(buf, sizeof buf, "%c\n", localtime(&tvec));
fprintf(fscript, _("\nScript done on %s"), buf);
}
- fclose(fscript);
+ if (close_stream(fscript) != 0)
+ errx(EXIT_FAILURE, _("write error"));
close(master);
master = -1;
#include <unistd.h>
#include <getopt.h>
+#include "closestream.h"
#include "nls.h"
#include "c.h"
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((ch = getopt_long(argc, argv, "t:s:d:Vh", longopts, NULL)) != -1)
switch(ch) {
#include "c.h"
#include "xalloc.h"
#include "nls.h"
+#include "closestream.h"
#if __GNU_LIBRARY__ < 5
#ifndef __alpha__
err(EXIT_DUMPFILE, _("can not open dump file %s for output"),
opt_sn_name);
screendump(opt_sn_num, F);
- fclose(F);
+ if (close_stream(F) != 0)
+ errx(EXIT_FAILURE, _("write error"));
}
/* -msg [on|off]. */
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
if (argc < 2)
bad_arg = TRUE;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include "nls.h"
+#include "nls.h"
+#include "closestream.h"
#include "pathnames.h"
#include "ttymsg.h"
#include "carefulputc.h"
#include "c.h"
#include "fileutils.h"
+#include "closestream.h"
#define IGNOREUSER "sleeper"
#define WRITE_TIME_OUT 300 /* in seconds */
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
static const struct option longopts[] = {
{ "nobanner", no_argument, 0, 'n' },
if (fread(mbuf, 1, *mbufsize, fp) != *mbufsize)
err(EXIT_FAILURE, _("fread failed"));
- fclose(fp);
+ if (close_stream(fp) != 0)
+ errx(EXIT_FAILURE, _("write error"));
return mbuf;
}
#include <paths.h>
#include <asm/param.h>
#include <getopt.h>
+
#include "c.h"
#include "carefulputc.h"
+#include "closestream.h"
#include "nls.h"
static void __attribute__ ((__noreturn__)) usage(FILE * out);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {