{"thread":{"id":"45651","subject":"[PATCH v1] convert: fix return value for apply_multi_file_filter() on SIGPIPE","startedAt":"2017-04-10T20:30:21Z","lastAt":"2017-04-10T20:30:21Z","messageCount":1,"participants":["Lars Schneider"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"316510","messageId":"20170410203011.54103-1-larsxschneider@gmail.com","threadId":"45651","inReplyTo":null,"subject":"[PATCH v1] convert: fix return value for apply_multi_file_filter() on SIGPIPE","fromName":"Lars Schneider","fromEmail":"larsxschneider@gmail.com","sentAt":"2017-04-10T20:30:11Z","receivedAt":"2017-04-10T20:30:21Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"If a pipe write fails and errno is set to EPIPE then we execute the\n\"error\" path. However, as \"err\" can still be 0 the return value of\napply_multi_file_filter() would indicate success.\n\nFix this by setting \"err\" to the value of \"errno\" in case of a pipe\nwrite failure.\n\nNoticed-by: Ben Peart <benpeart@microsoft.com>\nSigned-off-by: Lars Schneider <larsxschneider@gmail.com>\n---\n\nNotes:\n    Base Ref: master\n    Web-Diff: https://github.com/larsxschneider/git/commit/41a217c246\n    Checkout: git fetch https://github.com/larsxschneider/git errno-check-v1 && git checkout 41a217c246\n\n convert.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/convert.c b/convert.c\nindex 8d652bf27c..586e0cdd45 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -753,6 +753,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len\n \tsigchain_pop(SIGPIPE);\n \n \tif (err || errno == EPIPE) {\n+\t\terr = err ? err : errno;\n \t\tif (!strcmp(filter_status.buf, \"error\")) {\n \t\t\t/* The filter signaled a problem with the file. */\n \t\t} else if (!strcmp(filter_status.buf, \"abort\")) {\n\nbase-commit: b14f27f91770e0f99f64135348977a0ce1c7993a\n-- \n2.12.2\n\n"}]}