r750: check puts() return (#132 & #103)

This commit is contained in:
Heng Li
2018-03-22 11:31:58 -04:00
parent 18659118cd
commit 623b5d9d48
5 changed files with 24 additions and 7 deletions
+11
View File
@@ -1,3 +1,4 @@
#include <stdlib.h>
#include "mmpriv.h"
int mm_verbose = 1;
@@ -120,6 +121,16 @@ double realtime(void)
return tp.tv_sec + tp.tv_usec * 1e-6;
}
void mm_err_puts(const char *str)
{
int ret;
ret = puts(str);
if (ret == EOF) {
fprintf(stderr, "[ERROR] failed to write the results\n");
exit(EXIT_FAILURE);
}
}
#include "ksort.h"
#define sort_key_128x(a) ((a).x)