From patchwork Wed Jul 11 16:49:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Strachan X-Patchwork-Id: 942605 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="WzuXnVaV"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41QlR70rGLz9s0n for ; Thu, 12 Jul 2018 02:49:38 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4FF863E6AF4 for ; Wed, 11 Jul 2018 18:49:36 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id BAB3F3E6C00 for ; Wed, 11 Jul 2018 18:49:32 +0200 (CEST) Received: from mail-pf0-x24a.google.com (mail-pf0-x24a.google.com [IPv6:2607:f8b0:400e:c00::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 084D5600A18 for ; Wed, 11 Jul 2018 18:49:32 +0200 (CEST) Received: by mail-pf0-x24a.google.com with SMTP id f9-v6so15499868pfn.22 for ; Wed, 11 Jul 2018 09:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=i0hVYkqvKhTY4UHkiM4fSNmgyvgULubkCJHBp6/vPcg=; b=WzuXnVaV3tLqRtCu87N4dBMS0tWbnLoAgd8tJTPNZK2xcpyXJ/Ivxp6EjeCGKzvRkz q/D9tG0jV5rbw7ebjn5irZX2I22/plxLv7ypucu0PxjkNgTjoqnrzsvSguJPLgIhNy0f DTeQg2NJvBlI54KMdaIEFPusejLEKyyAJcVFlZu/qREYl0AEN/Jar145+hulOKIdw7I/ 6iD/2I/Zm+8rN25GKlT0pDiJdYx2XJezJEg8qukfj2lJa7g5lZ2lS8Ba+bzclrlpLDNw FH5N5+RRYtAw+Aa1KFbNlAiVNyJes00W9iGl13zTvS6frpeQUQDdX+SBIVG01EXXbCjd zIeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=i0hVYkqvKhTY4UHkiM4fSNmgyvgULubkCJHBp6/vPcg=; b=TQjPXDogUmFE8iNHs2nO25SsL2pQ8t1rzTUC0HTVhp8vY/3yrPKV3UEP1qzM0X2bQ9 B8wSqeiururLygJZRjTA1bmTy5x68rUn/iHkdV1wbwr0ILBG03leHR37tOHsxK0xx/g2 7rij2tlw0QkMb4n0/vkXqK6KQLO6jsiVwgXeRrGOeEQegNsA1EeQiPgNhPf0fDkbcnWW H/EU3ktH+Sh4RhH3f4ZqLzkfNjivPOu97sTnvfvXnm6hTKU4vq1JMpNVXwrS2Ot7/Mdr /cPn2SoayEwELgBQSkPXDYBsmzhMQnkoaeHhU1AMaLRXJPg9a142yKuzjYUctZWQZuE8 BK5g== X-Gm-Message-State: APt69E2N5+wMgL/DzjzQZIrFjxIpTd8kGqwE/OvhsQw25p45OY3Hg6mi OlMEn6iHEyPIdtHJevnz0K1gZ9OdllKcbr7kNIEcQr39UfoBa57ETwVBWdAAUwulIvZbLZn15TS N8RW+5c7s1utVOwmKgSviXWVnlS0zUiTxnDjtcWpSSwxq+lknYh8SKMTZv7CecH7o X-Google-Smtp-Source: AAOMgpcHPlPiZdviHALeC5p+5ka8KiS8u6dTI28GaZSe3qO9t0Zk0z/kN2LTmJmTo0mCpnNSc9yi2gMr/PF5VDs= MIME-Version: 1.0 X-Received: by 2002:a63:6243:: with SMTP id w64-v6mr7299125pgb.153.1531327770364; Wed, 11 Jul 2018 09:49:30 -0700 (PDT) Date: Wed, 11 Jul 2018 09:49:25 -0700 In-Reply-To: <20180711164925.65342-1-astrachan@google.com> Message-Id: <20180711164925.65342-2-astrachan@google.com> References: <20180703091057.pfvdfxelb2u6cewi@dell5510> <20180711164925.65342-1-astrachan@google.com> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog From: Alistair Strachan To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-7.4 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Cc: kernel-team@android.com Subject: [LTP] [PATCH] pounder21: Replace {r,}index() with str{r,}chr() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The index() and rindex() functions were removed in POSIX.2008. They are not implemented by Android's bionic C library for 64-bit platforms. Use the more portable strchr() and strrchr() functions from C89. Affects fancy_timed_loop, infinite_loop, run-helper, and timed_loop targets. Signed-off-by: Alistair Strachan --- tools/pounder21/fancy_timed_loop.c | 4 ++-- tools/pounder21/infinite_loop.c | 4 ++-- tools/pounder21/run.c | 6 +++--- tools/pounder21/timed_loop.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/pounder21/fancy_timed_loop.c b/tools/pounder21/fancy_timed_loop.c index ac3e204d1..f88be3df8 100644 --- a/tools/pounder21/fancy_timed_loop.c +++ b/tools/pounder21/fancy_timed_loop.c @@ -93,14 +93,14 @@ int main(int argc, char *argv[]) out = stdout; if (use_max_failures) { - progname = rindex(argv[7], '/'); + progname = strrchr(argv[7], '/'); if (progname == NULL) { progname = argv[7]; } else { progname++; } } else { - progname = rindex(argv[5], '/'); + progname = strrchr(argv[5], '/'); if (progname == NULL) { progname = argv[5]; } else { diff --git a/tools/pounder21/infinite_loop.c b/tools/pounder21/infinite_loop.c index fbe4289ac..e1a0d3dfb 100644 --- a/tools/pounder21/infinite_loop.c +++ b/tools/pounder21/infinite_loop.c @@ -78,14 +78,14 @@ int main(int argc, char *argv[]) out = stdout; if (use_max_failures) { - progname = rindex(argv[3], '/'); + progname = strrchr(argv[3], '/'); if (progname == NULL) { progname = argv[3]; } else { progname++; } } else { - progname = rindex(argv[1], '/'); + progname = strrchr(argv[1], '/'); if (progname == NULL) { progname = argv[1]; } else { diff --git a/tools/pounder21/run.c b/tools/pounder21/run.c index dec2d3fe7..5f5903c45 100644 --- a/tools/pounder21/run.c +++ b/tools/pounder21/run.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) retcode = process_dir(argv[1]); } else { if (is_executable(argv[1])) { - c = rindex(argv[1], '/'); + c = strrchr(argv[1], '/'); c++; // Start the test @@ -495,7 +495,7 @@ static pid_t spawn_test(char *fname) getenv("POUNDER_LOGDIR"), fname); fd = strlen(buf2); - for (tmp = (index(buf2, '|') - buf2); tmp < fd; tmp++) { + for (tmp = (strchr(buf2, '|') - buf2); tmp < fd; tmp++) { if (buf2[tmp] == '/') { buf2[tmp] = '-'; } else if (buf2[tmp] == '|') { @@ -541,7 +541,7 @@ static pid_t spawn_test(char *fname) snprintf(buf2, TEST_PATH_LEN, "%s/%s", buf, fname); // find the location of the last slash - last_slash = rindex(buf2, '/'); + last_slash = strrchr(buf2, '/'); if (last_slash != NULL) { // copy the filename part into a new buffer diff --git a/tools/pounder21/timed_loop.c b/tools/pounder21/timed_loop.c index 51ceac5f2..3dffba0dc 100644 --- a/tools/pounder21/timed_loop.c +++ b/tools/pounder21/timed_loop.c @@ -95,14 +95,14 @@ int main(int argc, char *argv[]) out = stdout; if (use_max_failures) { - progname = rindex(argv[4], '/'); + progname = strrchr(argv[4], '/'); if (progname == NULL) { progname = argv[4]; } else { progname++; } } else { - progname = rindex(argv[2], '/'); + progname = strrchr(argv[2], '/'); if (progname == NULL) { progname = argv[2]; } else {