Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-11-03 11:48:50 +0300
committerJunio C Hamano <gitster@pobox.com>2018-11-05 07:42:11 +0300
commit2179045fd02acca83127f8d15ccd0eeb70b17400 (patch)
tree9fdc037f4ae68e04712ddc63d77d5a2955471674 /preload-index.c
parentf5c4a9af45fa47130c730a5da87e030d040f000b (diff)
Clean up pthread_create() error handling
Normally pthread_create() rarely fails. But with new pthreads wrapper, pthread_create() will return ENOSYS on a system without thread support. Threaded code _is_ protected by HAVE_THREADS and pthread_create() should never run in the first place. But the situation could change in the future and bugs may sneak in. Make sure that all pthread_create() reports the error cause. While at there, mark these strings for translation if they aren't. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'preload-index.c')
-rw-r--r--preload-index.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/preload-index.c b/preload-index.c
index 0e24886aca..ddca1c216e 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -121,6 +121,8 @@ static void preload_index(struct index_state *index,
for (i = 0; i < threads; i++) {
struct thread_data *p = data+i;
+ int err;
+
p->index = index;
if (pathspec)
copy_pathspec(&p->pathspec, pathspec);
@@ -129,8 +131,10 @@ static void preload_index(struct index_state *index,
if (pd.progress)
p->progress = &pd;
offset += work;
- if (pthread_create(&p->pthread, NULL, preload_thread, p))
- die("unable to create threaded lstat");
+ err = pthread_create(&p->pthread, NULL, preload_thread, p);
+
+ if (err)
+ die(_("unable to create threaded lstat: %s"), strerror(err));
}
for (i = 0; i < threads; i++) {
struct thread_data *p = data+i;