Commit edef91ee25eddcda1db9af64c99d3913c45e3a18

Carlos Martín Nieto 2015-05-15T12:23:27

fileops: set an error on write error for file copy We set an error if we get an error when reading, but we don't bother setting an error message for write failing. This causes a cryptic error to be shown to the user when the target filesystem is full.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/fileops.c b/src/fileops.c
index 566aed1..b7b5515 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -703,6 +703,9 @@ static int cp_by_fd(int ifd, int ofd, bool close_fd_when_done)
 		error = (int)len;
 	}
 
+	if (error < 0)
+		giterr_set(GITERR_OS, "write error while copying file");
+
 	if (close_fd_when_done) {
 		p_close(ifd);
 		p_close(ofd);