{"thread":{"id":"22818","subject":"[PATCH] Fix gitmkdtemp: correct test for mktemp() return value","startedAt":"2010-02-25T10:01:31Z","lastAt":"2010-02-25T18:05:46Z","messageCount":3,"participants":["Filippo Negroni","Junio C Hamano","Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"135668","messageId":"4B864A7B.9000500@flexerasoftware.com","threadId":"22818","inReplyTo":null,"subject":"[PATCH] Fix gitmkdtemp: correct test for mktemp() return value","fromName":"Filippo Negroni","fromEmail":"fnegroni@flexerasoftware.com","sentAt":"2010-02-25T10:01:31Z","receivedAt":"2010-02-25T10:01:31Z","isPatch":true,"sender":{"key":"fnegroni@flexerasoftware.com","avatar":null},"body":">From 5e3b362cdd86150de901312c01beac9596b7e2ba Mon Sep 17 00:00:00 2001\nFrom: Filippo Negroni <fnegroni@flexerasoftware.com>\nDate: Thu, 25 Feb 2010 09:39:56 +0000\nSubject: [PATCH] Fix gitmkdtemp: correct test for mktemp() return value\n\nIn gitmkdtemp, the return value of mktemp is not tested correctly.\nmktemp() always returns its 'template' argument, even upon failre.\nUpon failure, mktemp sets template to be an empty string: its first character is '\\0'.\nThis patch ensures the return value of mktemp is correctly tested by dereferencing the pointer returned by it.\n\nSigned-off-by: Filippo Negroni <fnegroni@flexerasoftware.com>\n---\n compat/mkdtemp.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/compat/mkdtemp.c b/compat/mkdtemp.c\nindex 34d4b49..1136119 100644\n--- a/compat/mkdtemp.c\n+++ b/compat/mkdtemp.c\n@@ -2,7 +2,7 @@\n \n char *gitmkdtemp(char *template)\n {\n-       if (!mktemp(template) || mkdir(template, 0700))\n+       if (!*mktemp(template) || mkdir(template, 0700))\n                return NULL;\n        return template;\n }\n-- \n1.6.4\n"},{"id":"135683","messageId":"7veik99q4q.fsf@alter.siamese.dyndns.org","threadId":"22818","inReplyTo":"4B864A7B.9000500@flexerasoftware.com","subject":"Re: [PATCH] Fix gitmkdtemp: correct test for mktemp() return value","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-25T17:33:41Z","receivedAt":"2010-02-25T17:33:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Filippo Negroni <fnegroni@flexerasoftware.com> writes:\n\n> From 5e3b362cdd86150de901312c01beac9596b7e2ba Mon Sep 17 00:00:00 2001\n> From: Filippo Negroni <fnegroni@flexerasoftware.com>\n> Date: Thu, 25 Feb 2010 09:39:56 +0000\n> Subject: [PATCH] Fix gitmkdtemp: correct test for mktemp() return value\n>\n> In gitmkdtemp, the return value of mktemp is not tested correctly.\n> mktemp() always returns its 'template' argument, even upon failre.\n> Upon failure, mktemp sets template to be an empty string: its first character is '\\0'.\n> This patch ensures the return value of mktemp is correctly tested by dereferencing the pointer returned by it.\n>\n> Signed-off-by: Filippo Negroni <fnegroni@flexerasoftware.com>\n> ---\n\nThanks.\n\nNext time please do not quote the mbox header lines (i.e. start your body\nwith \"In gitmkdtemp, the return value ...\".\n"},{"id":"135685","messageId":"vpqzl2xdwcl.fsf@bauges.imag.fr","threadId":"22818","inReplyTo":"7veik99q4q.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Fix gitmkdtemp: correct test for mktemp() return value","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-02-25T18:05:46Z","receivedAt":"2010-02-25T18:05:46Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Next time please do not quote the mbox header lines (i.e. start your body\n> with \"In gitmkdtemp, the return value ...\".\n\n... or just use \"git send-email\", which does the trick for you.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}