Skip to content
Snippets Groups Projects
Commit b8ba6796 authored by Mark Grondona's avatar Mark Grondona
Browse files

o cbuf_write_from_fd() may return short reads -- read until EOF.

parent 117128c3
No related branches found
No related tags found
No related merge requests found
...@@ -551,8 +551,15 @@ _build_script (char *fname, int file_type) ...@@ -551,8 +551,15 @@ _build_script (char *fname, int file_type)
int len = buffer ? strlen(buffer) : 0; int len = buffer ? strlen(buffer) : 0;
int size; int size;
if ((size = cbuf_write_from_fd(cb, fd, -1, NULL)) < 0) while ((size = cbuf_write_from_fd(cb, fd, -1, NULL)) > 0)
error("Unable to read %s", fname); ;
if (size < 0) {
error ("unable to read %s: %m", fname);
cbuf_destroy(cb);
return NULL;
}
cbuf_write(cb, "\0", 1, NULL); cbuf_write(cb, "\0", 1, NULL);
xrealloc(buffer, cbuf_used(cb) + len +1); xrealloc(buffer, cbuf_used(cb) + len +1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment