Message ID | 20220308085352.183941-2-gary.bisson@boundarydevices.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCL5RYHM6ECRBTVTTSIQMGQESB2QQ4I@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=KmuIs9Ji; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::b39; helo=mail-yb1-xb39.google.com; envelope-from=swupdate+bncbcl5ryhm6ecrbtvttsiqmgqesb2qq4i@googlegroups.com; receiver=<UNKNOWN>) Received: from mail-yb1-xb39.google.com (mail-yb1-xb39.google.com [IPv6:2607:f8b0:4864:20::b39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KCTfV40PSz9sGF for <incoming@patchwork.ozlabs.org>; Tue, 8 Mar 2022 19:54:41 +1100 (AEDT) Received: by mail-yb1-xb39.google.com with SMTP id a3-20020a5b0ac3000000b006288f395b25sf15918228ybr.18 for <incoming@patchwork.ozlabs.org>; Tue, 08 Mar 2022 00:54:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646729678; cv=pass; d=google.com; s=arc-20160816; b=ezVACsAhbYO/Lf9o/w1yrPZwSsai48wrbV9BGlLDM7vZKVqGLGzO9rItkK71rkoDnk ibjaX7NyVCAU15JQEpLg3DYDrFWHoiU0aerscmhAtDgbJXKVGF/FGP0KjBaA8lUF3vSM 8zsTlKDfi+1V/YORyBI8yd/K/9PLKwJM1UWhQcQ/0fCm5YDH9E004ypiSb4tmrY9MGg0 9wr/G7gE7oXL6bAxLyvBPL1hMd0Gqr+iDzMp5VSfFZk/NVoDmxkk+jz75JVzC6oE1dsY n8ci3s9b/TQhoxt4VAu/mWiJ8hlzY+ZgfdeXLKtfTvQpd/crW97f+u/jifH80dGM72vB Ut0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=4QAjaUvVGfV39fXhRUw1U97OmsMKCSlzMRqT040AiE8=; b=mB2xliykBHYch/XYchouRW09+Pu+YK3nEhnJ5MAkZhvV2qncII7pavS8o9Wnnbj5rb CTrm+J0iDBx8ee8fHhSO/31KWb195gzsiw/uc8P1YWBXfwCRhoHY1jiAb+XzpOvlGhGg e/SOc+3/Z4mpwvBJU0mTuj6EzZOZQCvWSO2GPC5nN3fPK1lzaZ8zTxPwSX+zv0g2ZWyI 7c2EbmC8BburKOzeeGYK4X6pmDZ8lZFCQe7rwi7Xcfwdo106zO8H4GOgTsQ1p8kC7z/s oCuto4FTQ61wDomyYD22MURY1Ry+tNH1VJUlt/bCxg8UOOgZ/5NDdgaamF30evqQkVDe Mm/w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@boundarydevices.com header.s=google header.b=dLYn+wG7; spf=pass (google.com: domain of gary.bisson@boundarydevices.com designates 2607:f8b0:4864:20::62e as permitted sender) smtp.mailfrom=gary.bisson@boundarydevices.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=boundarydevices.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=4QAjaUvVGfV39fXhRUw1U97OmsMKCSlzMRqT040AiE8=; b=KmuIs9Jijsyj0xHt4BUjT3bdhqBYgM+BxFbWraJbKZo9tOQqM/+e1MDC8RsTtrg+ZX JvMdj/jSkF6lGYi1/c0TQneQCaPmjunKBMT7/CoirKytWNc/MqZtPR2EwVlHfb78c/iS uGEWH1LU+ba4BYyPA5bq55y+RLAtIowD+q2f7nkvWiJ6coEb5g1Rh+KcFGjrPZIvqjwo AO/zBDdjzqaXKapWjAC7ZQ5EPYscbl4g0gv/xg6ZRfD+lDxQtfZt3zVn9f+125KeCB/+ 4yW8zeAdhVaSEOkwUokoN9Yq78oX1aatH8grzorrmVH6Sou0iAQMxjoKk/7dp2nPEw03 moLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=4QAjaUvVGfV39fXhRUw1U97OmsMKCSlzMRqT040AiE8=; b=FLACBWZfBHMjoBEuH6j1VkuT+1sedhiMOpoP73VrYmSZ/PQ4HmZHBcRfBRIqMH7rhe G7qzYNSpRlrhvvAh9O80c1pJIaF5h62nKrJddhexYBbr2VT9gq/d7ql4SzHmD0QvrmHo JLgg7O3vx2a7gccZbk+nWBVrw55U3Fm7uFy80uf/0Y1DAhfb7lemGkYyQ0SO8ufU0wJg zcoFXbDiH0nMxtg/UybHN7xOE4r746MCaBvVPvp/Drb6DqkOZSxOCRTPhPfa9an4bHKL vlizb6DOaxHEl4u88HCIK5IfQcEoyTmJ89aiVre8/qYKaQFBRfKDAerqzSWjnSsx9ec0 i2BA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532jVl+XP5pFZ027ib8ApJ/YB+AX3IbOPTqLs9ToyDbiLW4NVvzX 7LaUhI1ZqIhWy/QIea/Jq7E= X-Google-Smtp-Source: ABdhPJzb0fcvyOAL+N2RrEISJDT5Rf7TqFs4NZyfTth/TD7q5SN4fPlOj56FJPTTvElVWBpwCkYe3Q== X-Received: by 2002:a81:1a05:0:b0:2db:f52a:a5cc with SMTP id a5-20020a811a05000000b002dbf52aa5ccmr11626764ywa.261.1646729678567; Tue, 08 Mar 2022 00:54:38 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6902:110c:b0:629:2656:4307 with SMTP id o12-20020a056902110c00b0062926564307ls4101631ybu.4.gmail; Tue, 08 Mar 2022 00:54:38 -0800 (PST) X-Received: by 2002:a25:6158:0:b0:628:6196:3aec with SMTP id v85-20020a256158000000b0062861963aecmr11630225ybb.363.1646729677936; Tue, 08 Mar 2022 00:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646729677; cv=none; d=google.com; s=arc-20160816; b=0hlghTMPqVL3n9iZN5hat8m7dUw2yZnjxbxFDc/9WNgi8eYxLnLa8otUFbvqMyYn+5 pnosiLqKuJSWFq7tr+5H+i5u+ahsSZcVZ/UScWNAW7bp3k1f/rcBTBaR1SNZ3vq/xjy+ x/OhE8zP0h7U5vi+4kQK36m9uCmVvVTIaqVBBNin/Z8yMUuePzIfKMeNwWIz6TUMgcWf eCOW57Yi0CqSqie3H4m91/q/H3E8HzUO9z1UIKPfg+jsKNSKHoYOOuP/FjtT1FPdyP6N MxIxyZb+jEMHUAKQphauPvR45SRYg3CwZf8l4c9qDdshFXDHWEO6pGJO0Mnx9gsR5BGb DZUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=xs3y47E3wlsR8XN1sB8yHMX5dd1SBV0f5+Z0MffC+Gw=; b=GgPk+FOCmUfypMkis4wrNQK6+q3ErB0+Ew1lBR2QklnS79ESA/w4kQXdIa5Kqa5RCn hlqeJ/azOloiupIjd9yH94cFS57VVXzUsuHmCByEPxGwyr6m4YBcRkTGEB0KX94dXuuc I6bObhf63RHItO6Ce0Cezgpj32v2UA5LBzGfj3FBMClodvCYmSqa0j0EfrcUB5qERhE3 8z3tthhiqGCDu0nkBGsRqSJCn6AbNaS8J7ca3hQN2uK4m2E924o61SL3n/49jgbv9yMS 1sRb4QWK4BFsbeJsU0SBjnCsVCZHsS8dAAQMJ2Tfnrq8CPu/o6U8rOjt6JmAeMWrgho1 aCSA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@boundarydevices.com header.s=google header.b=dLYn+wG7; spf=pass (google.com: domain of gary.bisson@boundarydevices.com designates 2607:f8b0:4864:20::62e as permitted sender) smtp.mailfrom=gary.bisson@boundarydevices.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=boundarydevices.com Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com. [2607:f8b0:4864:20::62e]) by gmr-mx.google.com with ESMTPS id q131-20020a819989000000b002d128e6be04si965607ywg.3.2022.03.08.00.54.37 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Mar 2022 00:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of gary.bisson@boundarydevices.com designates 2607:f8b0:4864:20::62e as permitted sender) client-ip=2607:f8b0:4864:20::62e; Received: by mail-pl1-x62e.google.com with SMTP id s18so3227196plp.1 for <swupdate@googlegroups.com>; Tue, 08 Mar 2022 00:54:37 -0800 (PST) X-Received: by 2002:a17:90b:1c03:b0:1bf:5720:f8a1 with SMTP id oc3-20020a17090b1c0300b001bf5720f8a1mr3535034pjb.100.1646729676705; Tue, 08 Mar 2022 00:54:36 -0800 (PST) Received: from localhost.localdomain (2a01cb0007fc20008a20f9fbd85df515.ipv6.abo.wanadoo.fr. [2a01:cb00:7fc:2000:8a20:f9fb:d85d:f515]) by smtp.gmail.com with ESMTPSA id mp10-20020a17090b190a00b001bf8453aea8sm1888132pjb.42.2022.03.08.00.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:54:36 -0800 (PST) From: Gary Bisson <gary.bisson@boundarydevices.com> To: swupdate@googlegroups.com Cc: Gary Bisson <gary.bisson@boundarydevices.com> Subject: [swupdate] [PATCH v2 1/6] uboot_env: switch to strchr/strrchr Date: Tue, 8 Mar 2022 09:53:47 +0100 Message-Id: <20220308085352.183941-2-gary.bisson@boundarydevices.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220308085352.183941-1-gary.bisson@boundarydevices.com> References: <20220306132635.220607-1-gary.bisson@boundarydevices.com> <20220308085352.183941-1-gary.bisson@boundarydevices.com> MIME-Version: 1.0 X-Original-Sender: gary.bisson@boundarydevices.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@boundarydevices.com header.s=google header.b=dLYn+wG7; spf=pass (google.com: domain of gary.bisson@boundarydevices.com designates 2607:f8b0:4864:20::62e as permitted sender) smtp.mailfrom=gary.bisson@boundarydevices.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=boundarydevices.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series | [v2,1/6] uboot_env: switch to strchr/strrchr | expand |
diff --git a/src/uboot_env.c b/src/uboot_env.c index af415c1..a18c246 100644 --- a/src/uboot_env.c +++ b/src/uboot_env.c @@ -172,7 +172,7 @@ static int ubi_get_dev_id(char *device) int dev_id = -1; char *sep; - sep = rindex(device, 'i'); + sep = strrchr(device, 'i'); if (sep) sscanf(sep + 1, "%d", &dev_id); @@ -273,7 +273,7 @@ static int ubi_update_name(struct uboot_flash_env *dev) int dev_id, vol_id, ret = -EBADF; char *sep; - sep = index(dev->devname, DEVNAME_SEPARATOR); + sep = strchr(dev->devname, DEVNAME_SEPARATOR); if (sep) { memset(device, 0, DEVNAME_MAX_LENGTH); @@ -308,7 +308,7 @@ static int normalize_device_path(char *path, struct uboot_flash_env *dev) * if volume name is present, split into device path and volume * since only the device path needs normalized */ - sep = index(path, DEVNAME_SEPARATOR); + sep = strchr(path, DEVNAME_SEPARATOR); if (sep) { volume_len = strlen(sep);
First reason is because index/rindex aren't present in Bionic C library. Also, per the man page [1]: "marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specifications of index() and rindex(), recommending strchr(3) and strrchr(3) instead." [1] https://man7.org/linux/man-pages/man3/index.3.html Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> --- Changelog v1->v2: - None --- src/uboot_env.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)