]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
fix some coverity warnings
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 9 Jan 2017 12:43:26 +0000 (13:43 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 12 Jan 2017 15:34:27 +0000 (16:34 +0100)
client.c
main.c
sys_timex.c

index dbc9d6fa3208c9eea94a82da25b11ef9c2192b7a..c6e44b36ec191793af638722c1398898cc1dc444 100644 (file)
--- a/client.c
+++ b/client.c
@@ -2723,7 +2723,8 @@ process_cmd_waitsync(char *line)
   max_skew_ppm = 0.0;
   interval = 10.0;
 
-  sscanf(line, "%d %lf %lf %lf", &max_tries, &max_correction, &max_skew_ppm, &interval);
+  if (sscanf(line, "%d %lf %lf %lf", &max_tries, &max_correction, &max_skew_ppm, &interval))
+    ;
 
   /* Don't allow shorter interval than 0.1 seconds */
   if (interval < 0.1)
@@ -2831,7 +2832,8 @@ process_cmd_keygen(char *line)
   snprintf(hash_name, sizeof (hash_name), "MD5");
 #endif
 
-  sscanf(line, "%u %16s %d", &id, hash_name, &bits);
+  if (sscanf(line, "%u %16s %d", &id, hash_name, &bits))
+    ;
 
   length = CLAMP(10, (bits + 7) / 8, sizeof (key));
   if (HSH_GetHashId(hash_name) < 0) {
diff --git a/main.c b/main.c
index aaa8744a7d211cdd97411f726898688d9d0ae175..2f2935889ea6b9fe47c0b0bd79096de5a3cf7091 100644 (file)
--- a/main.c
+++ b/main.c
@@ -325,7 +325,8 @@ go_daemon(void)
     if (r) {
       if (r > 0) {
         /* Print the error message from the child */
-        fprintf(stderr, "%.1024s\n", message);
+        message[sizeof (message) - 1] = '\0';
+        fprintf(stderr, "%s\n", message);
       }
       exit(1);
     } else
index 7abb629e4503913d74ba2c976da7fd04647c1756..4ec4ce83b481aecbf30d804e28d1ed9f27bc4ed8 100644 (file)
@@ -158,7 +158,8 @@ set_sync_status(int synchronised, double est_error, double max_error)
   txc.esterror = est_error * 1.0e6;
   txc.maxerror = max_error * 1.0e6;
 
-  SYS_Timex_Adjust(&txc, 1);
+  if (SYS_Timex_Adjust(&txc, 1) < 0)
+    ;
 }
 
 /* ================================================== */