From patchwork Wed Nov 14 15:36:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 997793 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=googlegroups.com (client-ip=2a00:1450:4864:20::338; helo=mail-wm1-x338.google.com; envelope-from=swupdate+bncbcxploxj6ikrb6mbwhpqkgqebxm6xfy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="fE+qFhZP"; dkim-atps=neutral Received: from mail-wm1-x338.google.com (mail-wm1-x338.google.com [IPv6:2a00:1450:4864:20::338]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42w7rY18Q9z9sBN for ; Thu, 15 Nov 2018 02:36:28 +1100 (AEDT) Received: by mail-wm1-x338.google.com with SMTP id 131-v6sf16066878wmn.7 for ; Wed, 14 Nov 2018 07:36:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1542209785; cv=pass; d=google.com; s=arc-20160816; b=j4jQ3vq+Zp9Cvrim4SwRuF+LJuxX7Pgkb6QQ9pQuepkc1snFy5Vvk5/u9TDg9g3NDo 2UF6NNLNABVEkHAborXfwCnky2YY6WOh9e9M0ZNoxMd4qBY24VXyN/F4b5P+0WXJpHSB GSJNxRM0xByE5uKN7ZaIZYjv8i3s+P6SyU0Ni9oPk7T3DnZ43E2ATTWnLagsSgCQmMnI oTKAQJe8nK7TRCYqJrnmITUnxLlKFlOr+Al+QZf+U7Yaq0OFEy/EAPsDXiKqWzu+iINO lDPo9tueKI/XoJqSjMN+hFJ0XBqGheF4ZJApbfoJF5JuLQeD9Lku6REgw2wXK0S+uPZM MgYw== 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:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=3Fmvq9X8v0p18pG1FjeNC20sURgnkwmNMVCFPMEYwfI=; b=Fu++lf7hz3BsinU76WXDhrN1Gy4iDql44gCEMh7rH/zod5qeYbifgSw5HpKlYC7Ffc u3ltc8J41u7oQFVuF7AulKH+iNvNI1PEQ6FGCw1deimzvnqq8Q0z3I05mWio2mwbF3OJ a5oZ04+VadkaymZlQRswqdxcM9kgClGUFS76bmE30haJzz3Te19d/nko6O/eZYzKV7ua wNAeQPA1pcdpIf0S/Or+RtPsXR//lexYXLKnuUNOXluZiL4V3CQrwBnl3n4ypdUYJcwd S3NJCu9WyPM98Reajv4VD6nppp76HkDMeTKjLRLOTuJFAFsDw1P0DxzBzkfNFcCRTgBX 3bvA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=3Fmvq9X8v0p18pG1FjeNC20sURgnkwmNMVCFPMEYwfI=; b=fE+qFhZP422nnxkfc/LggzOzUp+tcyPlya1jQpfgU+xvYDe1hkDAq/j2kN/PwDvwu5 SV4LOum4q2tpdxERORi0fQueTBOBHqgsqiX2Zo6hodiCfA/5/t/1k4IoQRAhZOgL3GJM gzXdKsqqCDqoHrSSj9r8/tWBZinKWCDGI61l6Ufz7Pv+1DCOOLOdUG77HIJ3jUjW8W4j sOI+ocw1rek3X3EEuFQbjvtovDSE80AQxssauq43TgcIS1MZ5ovg7J3XBX2HYgjMsJic l/OuBn2UKcnBEnW8WVn8D10g4k0+D4SMRGKRZBOdQEkDvNZr2x/l9k0HqlPgbYrFQdrG Butw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id: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=3Fmvq9X8v0p18pG1FjeNC20sURgnkwmNMVCFPMEYwfI=; b=R+8Cf1AckggryAtbX7DoWfeQv5xOLUbqI5KhMzF56dRm5ATqD6DgZKHABbw2y3yWCT 2pgJKUAcXQKqiwxO/NX2fgckGhAlNZN1TI7iECh2ngsgc11sBnLFZufXQIt/dJjO/nj2 MQ1N0MPeIpA3q5PLnnB/K8iWuXAb9tOJeGrnO0FyAVFEHcwvfvVkufU6kL7+89yAPM56 7zF8GipvO7qWv7ktjDqJOfFR1Qxrfq15mRtJsgUtbIDOjc3FM3A4Qto8bpfqWED1iO7x 9twEr9+DPQvOWVOtfgfFRvLI4xPh9xayaBgvhhVTivICMC0cBCwVBzRc5WnS8EudvUQr XcgQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AGRZ1gLgXPLAzIitLCkjg0tEWgUd6R85pfAg86mSxJo5715yY4yG/2Hl yPM3d+b8jDZm67YvDmdgx7A= X-Google-Smtp-Source: AJdET5d0AvKwekTxCivEQpTbtJDbJbu+xPcpU2nrSyPD/ewhK1954HeY1tKkbPp3mpbmX+CZJKxaCw== X-Received: by 2002:adf:8247:: with SMTP id 65mr34691wrb.3.1542209785578; Wed, 14 Nov 2018 07:36:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:6983:: with SMTP id g3-v6ls4392273wru.10.gmail; Wed, 14 Nov 2018 07:36:24 -0800 (PST) X-Received: by 2002:a5d:4dd0:: with SMTP id f16-v6mr470318wru.10.1542209784877; Wed, 14 Nov 2018 07:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542209784; cv=none; d=google.com; s=arc-20160816; b=lg2CL5pu/W22lx00ebZKfGHF5UzZGToMjEN0b+JHTz4b1vmyqNROD5OPC1kwCWYplA ztY7V7dTXFXyN5OLRgomfE1ob7/XY4ksz32J4mjra6s64cAFkMShNIHWEHr90sQL4CjL pWPiqCoCgAU2fS+4/bKiz8VMDx+TZu876To0YdGvaofm7qDMQgj0Kpmd0rwnLR4bwXcf tLs3dwINVkE3GantoCAsTZb7lrL1IABkMfVrjUle+4Dh9MTC4MyL+bS7cpnyGbDwMlcH ZSDQYOSRmB2fTN9cx03TUgI4oML+zw5OIDm7Xkge1OXMfNCsDEmCcObeOXWgPHpvcsGt g4iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=Vjq29u3u8QDy2fWqspGNb1RkugpYWjllL8jez6J1goI=; b=mIbZil9Ny3j59pYlFLO4ROArv3onX499dVQF5oYq34u4aB2landlkFl0JTv2uChMZO UT5GMS2LzAa4mK0l+MyOlCOnXnRNogs+ft97MZcbZua2xUaNrh1i3PSITOH5luzu42m+ IbqjfQk6yBE14aoPuuNKbDPjCoOLZ81I0SMrLlbcoNcwAMyvBAfygrF6OXS2mKbDkdUq 1iU2E7iyrABOX1KRfNmE54J5NrRO11IEiq4dDkiRHuZ7hK49sbNsIhXTHo8+4OmYdoXA p0JpOefIRNqOXs8EGmlI9L2l2tyjAvjb04e+YJ5mZR1tO0rzGLBts60OoWhp+iLr/Fk2 UHGQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id o8-v6si688730wmd.2.2018.11.14.07.36.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 07:36:24 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42w7rS4yH2z1qymj; Wed, 14 Nov 2018 16:36:24 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42w7rS4ncYz1qsJK; Wed, 14 Nov 2018 16:36:24 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id T29Ak_uCURRZ; Wed, 14 Nov 2018 16:36:21 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Wed, 14 Nov 2018 16:36:21 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 137A14540471; Wed, 14 Nov 2018 16:36:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JDuzXrHUADCn; Wed, 14 Nov 2018 16:36:14 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id A7B364540038; Wed, 14 Nov 2018 16:36:14 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] dict: use reentrant version for strtok Date: Wed, 14 Nov 2018 16:36:12 +0100 Message-Id: <20181114153612.15952-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Signed-off-by: Stefano Babic --- corelib/swupdate_dict.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/corelib/swupdate_dict.c b/corelib/swupdate_dict.c index a5f14db..5970c55 100644 --- a/corelib/swupdate_dict.c +++ b/corelib/swupdate_dict.c @@ -177,6 +177,7 @@ int dict_parse_script(struct dict *dictionary, const char *script) int ret = 0; char *line = NULL, *key = NULL, *value = NULL; size_t len = 0; + char *saveptr; /* open script generated during sw-description parsing */ fp = fopen(script, "rb"); @@ -189,8 +190,8 @@ int dict_parse_script(struct dict *dictionary, const char *script) /* load key-value pairs from script into dictionary */ while ((getline(&line, &len, fp)) != -1) { - key = strtok(line, " \t\n"); - value = strtok(NULL, "\t\n"); + key = strtok_r(line, " \t\n", &saveptr); + value = strtok_r(NULL, "\t\n", &saveptr); if (value != NULL && key != NULL) { ret = dict_set_value(dictionary, key, value); if (ret) {