about summary refs log tree commit diff homepage
path: root/meta.c
diff options
context:
space:
mode:
Diffstat (limited to 'meta.c')
-rw-r--r--meta.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/meta.c b/meta.c
index 8e3b6a3..ede1041 100644
--- a/meta.c
+++ b/meta.c
@@ -17,7 +17,6 @@
 #include <err.h>
 #include <stdio.h>
 #include <sysexits.h>
-#include <unistd.h>
 
 #include "torus.h"
 
@@ -25,9 +24,9 @@ int main() {
     printf("tileX,tileY,createTime,modifyCount,modifyTime,accessCount,accessTime\n");
     for (int i = 0;; ++i) {
         struct Tile tile;
-        ssize_t len = read(STDIN_FILENO, &tile, sizeof(tile));
-        if (len < 0) err(EX_IOERR, "read");
-        if (!len) return EX_OK;
+        size_t count = fread(&tile, sizeof(tile), 1, stdin);
+        if (ferror(stdin)) err(EX_IOERR, "(stdin)");
+        if (!count) return EX_OK;
 
         printf(
             "%d,%d,%ld,%u,%ld,%u,%ld\n",