X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Floadgen.c;h=494c5ed75f5ef66bbe86e540940dda1c6d728118;hb=44888417ecbf09fc6f294311dd98914aefda05c4;hp=49d2425cbc97af7eb11e949c51b47576ffe95664;hpb=6794d7654b4c459519a9e6d85ed439c8c594c2e7;p=fs%2Flustre-release.git diff --git a/lustre/utils/loadgen.c b/lustre/utils/loadgen.c index 49d2425..494c5ed 100644 --- a/lustre/utils/loadgen.c +++ b/lustre/utils/loadgen.c @@ -26,6 +26,8 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -56,7 +58,9 @@ #include #include +#include #include +#include #include "obdctl.h" static char cmdname[512]; @@ -667,21 +671,31 @@ static void report_perf() static void *run_one_child(void *threadvp) { - struct kid_t *kid; - char oname[10], ename[10]; - int thread = (long)threadvp, dev = 0; - int rc = 0, err; - - if (o_verbose > 2) - printf("%s: running thread #%d\n", cmdname, thread); + struct kid_t *kid; + char oname[16], ename[16]; + int thread = (long)threadvp; + int dev = 0; + int err; + int rc; - sprintf(oname, "o%.5d", thread); - sprintf(ename, "e%.5d", thread); + if (o_verbose > 2) + printf("%s: running thread #%d\n", cmdname, thread); + + rc = snprintf(oname, sizeof(oname), "o%.5d", thread); + if (rc != 1) { + rc = -EFAULT; + goto out_exit; + } + rc = snprintf(ename, sizeof(ename), "e%.5d", thread); + if (rc != 1) { + rc = -EFAULT; + goto out_exit; + } rc = echocli_setup(oname, ename, &dev); if (rc) { fprintf(stderr, "%s: can't setup '%s/%s' (%d)\n", cmdname, oname, ename, rc); - pthread_exit((void *)(long)rc); + goto out_exit; } kid = push_kid(thread); @@ -733,7 +747,8 @@ out: err = cleanup(oname, 0); if (!rc) rc = err; - pthread_exit((void *)(long)rc); +out_exit: + pthread_exit((void *)(long)rc); } /*