Print this page
OS-1840 fmdump shall emit JSON (newlines, fflush)

@@ -76,13 +76,16 @@
 
 /*
  * Thin wrapper around libnvpair's inbuilt JSON routine.  Simply dumps the
  * entire log record nvlist without any reformatting.
  */
+
+/*ARGSUSED*/
 int
 fmdump_print_json(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
 {
-        nvlist_print_json(fp, rp->rec_nvl);
-        fprintf(fp, "\n");
+        if (nvlist_print_json(fp, rp->rec_nvl) || fprintf(fp, "\n") < 0 ||
+            fflush(fp) != 0)
+                return (-1);
 
         return (0);
 }