{"thread":{"id":"2971","subject":"fix potential deadlock in create_one_file","startedAt":"2006-01-05T09:00:12Z","lastAt":"2006-01-06T22:38:13Z","messageCount":2,"participants":["Alex Riesen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"14173","messageId":"81b0412b0601050100v519e76c8u11f4d484f9d28e0a@mail.gmail.com","threadId":"2971","inReplyTo":null,"subject":"fix potential deadlock in create_one_file","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-01-05T09:00:12Z","receivedAt":"2006-01-05T09:00:12Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"It can happen if the temporary file already exists (i.e. after a panic\nand reboot).\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n\n\nSubject: [PATCH] fix potential deadlock in create_one_file.\n\nIt can happen if the temporary file already exists.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n\n\n---\n\n apply.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\nf7ac9127638a013d0f1d60e02a06fde10909824c\ndiff --git a/apply.c b/apply.c\nindex d5e7bfd..ff3782b 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -1635,7 +1635,8 @@ static void create_one_file(const char *\n \t\t\t}\n \t\t\tif (errno != EEXIST)\n \t\t\t\tbreak;\n-\t\t}\t\t\t\n+\t\t\t++nr;\n+\t\t}\n \t}\n \tdie(\"unable to write file %s mode %o\", path, mode);\n }\n-- \n1.0.GIT\n"},{"id":"14211","messageId":"7vpsn5q8x6.fsf@assigned-by-dhcp.cox.net","threadId":"2971","inReplyTo":"81b0412b0601050100v519e76c8u11f4d484f9d28e0a@mail.gmail.com","subject":"Re: fix potential deadlock in create_one_file","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-06T22:38:13Z","receivedAt":"2006-01-06T22:38:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> It can happen if the temporary file already exists (i.e. after a panic\n> and reboot).\n\nWe use pid here and using somebody else's pid feels wrong but\nthat is only for collision avoidance, mktemp(3) is no better,\nand neither tmpfile(3) nor mkstemp(3) are usable for directories\nanyway, so your patch as is would be the best solution.\n\nThanks.\n"}]}