#include "c.h"
#include "clock.h"
+#include "closestream.h"
#include "nls.h"
#include "pathnames.h"
#include "strutils.h"
if ((fp = fopen(_PATH_LASTDATE, "w"))) {
fprintf(fp, "%02d.%02d.%04d\n", tm->tm_mday, tm->tm_mon + 1,
tm->tm_year + 1900);
- fclose(fp);
+ if (close_stream(fp) != 0)
+ warn(_("cannot write %s"), _PATH_LASTDATE);
} else
warn(_("cannot write %s"), _PATH_LASTDATE);
}
adj_file_name);
err = 1;
}
- if (fclose(adjfile) < 0) {
+ if (close_stream(adjfile) != 0) {
warn(_
("Could not update file with the clock adjustment "
"parameters (%s) in it"),
#endif
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
/* Set option defaults */
show = set = systohc = hctosys = systz = adjust = noadjfile = predict =