Re: [chrony-dev] GCC issue

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]



With a logical or, the fclose will not happen if fprintf fails.
Perhaps better separate these calls?

// Håkan


On Tue, 21 Jan 2014, Harald Krammer wrote:

Hello,

I am testing Chrony 1.29 on my ARM based System with GCC 3.4.6.

A small problem is happen in reference.c.  GCC 3.4.6 does not respect
the order in bit-wise or.  -> fclose comes for fprintf
-> a logical or works fine


Index: chrony/reference.c
===================================================================
--- chrony/reference.c
+++ chrony/reference.c
@@ -311,7 +311,7 @@
  }

  /* Write the frequency and skew parameters in ppm */
-  if ((fprintf(out, "%20.6f %20.6f\n", freq_ppm, 1.0e6 * skew) < 0) |
+  if ((fprintf(out, "%20.6f %20.6f\n", freq_ppm, 1.0e6 * skew) < 0) ||
      fclose(out)) {
    Free(temp_drift_file);
    LOG(LOGS_WARN, LOGF_Reference, "Could not write to temporary
driftfile %s.tmp",



Nice greetings,
Harald Krammer


--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/