Happy new year
[yaz-moved-to-github.git] / util / marcdump.c
index ed2096a..2331768 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2009 Index Data
  * See the file LICENSE for details.
  */
 
@@ -332,7 +332,11 @@ static void dump(const char *fname, const char *from, const char *to,
             r = yaz_marc_decode_buf(mt, buf, -1, &result, &len_result);
             if (r > 0 && result)
             {
-                fwrite (result, len_result, 1, stdout);
+                if (fwrite(result, len_result, 1, stdout) != 1)
+                {
+                    fprintf(stderr, "Write to stdout failed\n");
+                    break;
+                }
             }
             if (r > 0 && cfile)
             {