Permalink
Browse files

fix handling of zero-length files on standard input

  • Loading branch information...
johnkerl committed Jan 6, 2018
1 parent 33dff55 commit 3d8193ce2e631e1bc7a1042ddd7ba06b6dca75dc
Showing with 2 additions and 23 deletions.
  1. +2 −2 c/lib/mlrutil.c
  2. +0 −21 c/todo.txt
View
@@ -537,8 +537,8 @@ char* read_file_into_memory(char* filename, size_t* psize) {
return NULL;
}
int rc = fread(buffer, statbuf.st_size, 1, fp);
if (rc != 1) {
size_t rc = fread(buffer, 1, statbuf.st_size, fp);
if (rc != statbuf.st_size) {
fprintf(stderr, "Unable to read content of %s\n", filename);
perror("fread");
fprintf(stderr, "%s: could not fread \"%s\"\n", MLR_GLOBALS.bargv0, filename);
View
@@ -14,27 +14,6 @@ BUGFIXES
mlr: could not fread "/dev/null"
mlr: Couldn't open "/dev/null" for read.
* also do autodetect on comment-skip/pass:
$ mlr --pass-comments --idkvp --oxtab cat /Users/kerl/pub_http_internet/miller-releases/miller-head/c/output-regtest/comments1-crlf.dkvp|mlr lecat
# hello world 1[CR][LF]
a 1[CR][LF]
b 2[CR][LF]
c 3[CR][LF]
[CR][LF]
a 4[CR][LF]
b 5[CR][LF]
c 6[CR][LF]
$ mlr --no-mmap --pass-comments --idkvp --oxtab cat /Users/kerl/pub_http_internet/miller-releases/miller-head/c/output-regtest/comments1-crlf.dkvp|mlr lecat
# hello world 1[LF]
a 1[CR][LF]
b 2[CR][LF]
c 3[CR][LF]
[CR][LF]
a 4[CR][LF]
b 5[CR][LF]
c 6[CR][LF]
================================================================
5.3.0 TO DO:

0 comments on commit 3d8193c

Please sign in to comment.