commit 0605801d8523648622fc2176fd0422d3d5a6ad57 from: Stefan Sperling date: Sun Mar 11 11:44:13 2018 UTC check read() return value properly in read_meta_file() commit - 7ac97322017b91dbd1c5468717efc62243a851df commit + 0605801d8523648622fc2176fd0422d3d5a6ad57 blob - ae61678471cf7d1a0be8eb2f6793a23954d2637e blob + a84d489d174231aa2398640506134304ea5d1ba7 --- lib/worktree.c +++ lib/worktree.c @@ -114,7 +114,8 @@ read_meta_file(char **content, const char *path_got, c n = read(fd, *content, sb.st_size); if (n != sb.st_size) { - err = got_error_from_errno(); + err = (n == -1 ? got_error_from_errno() : + got_error(GOT_ERR_WORKTREE_META)); goto done; } if ((*content)[sb.st_size - 1] != '\n') {