#define SLOP (16)
-static void read_patch_file(struct strbuf *sb, int fd)
+static int read_patch_file(struct strbuf *sb, int fd)
{
if (strbuf_read(sb, fd, 0) < 0)
- die_errno("git apply: failed to read");
+ return error_errno("git apply: failed to read");
/*
* Make sure that we have some slop in the buffer
*/
strbuf_grow(sb, SLOP);
memset(sb->buf + sb->len, 0, SLOP);
+ return 0;
}
static unsigned long linelen(const char *buffer, unsigned long size)
int res = 0;
state->patch_input_file = filename;
- read_patch_file(&buf, fd);
+ if (read_patch_file(&buf, fd) < 0)
+ return -128;
offset = 0;
while (offset < buf.len) {
struct patch *patch;