diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-04-01 15:40:19 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-04-01 15:40:19 -0400 |
commit | c8ab44d29c3384210cd8f27533abfd0fb2205cc5 (patch) | |
tree | 91e09bbe8841e808492dc8e5671a2622aba5a419 /libdimension/raytrace.c | |
parent | e0313016725bc9f87243571e75b2e77f1cae265e (diff) | |
download | dimension-c8ab44d29c3384210cd8f27533abfd0fb2205cc5.tar.xz |
Set errno on failures.
Diffstat (limited to 'libdimension/raytrace.c')
-rw-r--r-- | libdimension/raytrace.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c index 61ebd08..840f6f2 100644 --- a/libdimension/raytrace.c +++ b/libdimension/raytrace.c @@ -19,6 +19,7 @@ *************************************************************************/ #include "dimension_impl.h" +#include <errno.h> /* * Boilerplate for multithreading @@ -59,6 +60,7 @@ dmnsn_raytrace_scene_async(dmnsn_scene *scene) payload = malloc(sizeof(dmnsn_raytrace_payload)); if (!payload) { dmnsn_delete_progress(progress); + errno = ENOMEM; return NULL; } @@ -95,6 +97,8 @@ dmnsn_raytrace_scene_thread(void *ptr) int *retval = malloc(sizeof(int)); if (retval) { *retval = dmnsn_raytrace_scene_multithread(payload); + } else { + errno = ENOMEM; } dmnsn_done_progress(payload->progress); free(payload); @@ -121,13 +125,15 @@ dmnsn_raytrace_scene_multithread(dmnsn_raytrace_payload *payload) payloads = malloc(nthreads*sizeof(dmnsn_raytrace_payload)); if (!payloads) { - return 1; + errno = ENOMEM; + return -1; } threads = malloc(nthreads*sizeof(pthread_t)); if (!threads) { free(payloads); - return 1; + errno = ENOMEM; + return -1; } /* Set up the progress object */ @@ -164,7 +170,7 @@ dmnsn_raytrace_scene_multithread(dmnsn_raytrace_payload *payload) } free(payloads); - return 1; + return -1; } } @@ -202,6 +208,8 @@ dmnsn_raytrace_scene_multithread_thread(void *ptr) *retval = dmnsn_raytrace_scene_impl(payload->progress, payload->scene, payload->bvst, payload->index, payload->threads); + } else { + errno = ENOMEM; } return retval; } |