}
/* Write the frequency and skew parameters in ppm */
- fprintf(out, "%20.4f %20.4f\n", freq_ppm, 1.0e6 * skew);
-
- fclose(out);
+ if ((fprintf(out, "%20.4f %20.4f\n", freq_ppm, 1.0e6 * skew) < 0) |
+ fclose(out)) {
+ LOG(LOGS_WARN, LOGF_Reference, "Could not write to temporary driftfile %s.tmp",
+ drift_file);
+ return;
+ }
/* Clone the file attributes from the existing file if there is one. */
}
/* Gain rate is written out in ppm */
- fprintf(out, "%1d %ld %.6f %.3f\n",
- valid,ref_time, offset, 1.0e6 * rate);
-
- fclose(out);
+ if ((fprintf(out, "%1d %ld %.6f %.3f\n",
+ valid,ref_time, offset, 1.0e6 * rate) < 0) |
+ fclose(out)) {
+ LOG(LOGS_WARN, LOGF_RtcLinux, "Could not write to temporary RTC file %s.tmp",
+ coefs_file_name);
+ return RTC_ST_BADFILE;
+ }
/* Clone the file attributes from the existing file if there is one. */