[tyndur-devel] [PATCH] libc: Fehler in mkstemp zurueckgeben
Kevin Wolf ·
! libc: mkstemp darf es nicht bei allen Fehlern nochmal versuchen. git versucht beispielsweise eine temporaere Datei anzulegen, die in einem Verzeichnis liegt, das erst angelegt wird, nachdem ein ENOENT kommt. Signed-off-by: Kevin Wolf <kevin at tyndur.org> --- src/modules/lib/posix/mktemp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/lib/posix/mktemp.c b/src/modules/lib/posix/mktemp.c index 9095afd..67940f2 100644 --- a/src/modules/lib/posix/mktemp.c +++ b/src/modules/lib/posix/mktemp.c @@ -96,14 +96,14 @@ int mkstemp(char* template) size_t len = strlen(template); char buf[len + 1]; - while (fd == -1) { + do { strcpy(buf, template); if (!mktemp(buf)) { return fd; } fd = open(buf, O_EXCL | O_CREAT); - } + } while (fd == -1 && (errno == EEXIST || errno == EINTR)); strcpy(template, buf); return fd; -- 1.6.0.2
Antworten
- [tyndur-devel] [PATCH] libc: Fehler in mkstemp zurueckgeben · Antoine Kaufmann