Mercurial > louis > mq > lightsd
changeset 471:3acc9eca7df9
wip on those archlinux build failures
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Mon, 20 Jun 2016 23:33:26 -0700 |
parents | 35cc7e8a16a5 |
children | d553a41aab6c 86f99a847b20 |
files | mkdtemp_error_handling.patch series |
diffstat | 2 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mkdtemp_error_handling.patch Mon Jun 20 23:33:26 2016 -0700 @@ -0,0 +1,27 @@ +# HG changeset patch +# Parent a427bc665234bd40731e481f96a9273510a6e4d3 +Improve error handling in lgtd_tests_make_temp_dir + +Hopefully let me solve those segfaults in the unit-tests of the pipe +module. + +diff --git a/tests/core/tests_utils.c b/tests/core/tests_utils.c +--- a/tests/core/tests_utils.c ++++ b/tests/core/tests_utils.c +@@ -186,10 +186,13 @@ + { + char buf[PATH_MAX] = { 0 }; + int n = snprintf(buf, sizeof(buf), "%s/lightsd.test.XXXXXXXX", P_tmpdir); +- if (n >= (int)sizeof(buf)) { +- errx(1, "cannot allocate temporary directory"); ++ if (n >= (int)sizeof(buf) || n < 0) { ++ lgtd_errx(1, "cannot allocate temporary directory"); + } +- return strdup(mkdtemp(buf)); ++ if (!mkdtemp(buf)) { ++ lgtd_errx(1, "cannot create temporary directory"); ++ } ++ return strdup(buf); + } + + void