From patchwork Fri Feb 2 17:23:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 1894713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=dZgGCENM; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ZZA65w3I; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::239; helo=mail-lj1-x239.google.com; envelope-from=swupdate+bncbdnyr2ftvyebb4oh6swqmgqet4xuh3a@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lj1-x239.google.com (mail-lj1-x239.google.com [IPv6:2a00:1450:4864:20::239]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TRMtz0tpRz1yhq for ; Sat, 3 Feb 2024 04:18:49 +1100 (AEDT) Received: by mail-lj1-x239.google.com with SMTP id 38308e7fff4ca-2d08138565dsf11336581fa.3 for ; Fri, 02 Feb 2024 09:18:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706894323; cv=pass; d=google.com; s=arc-20160816; b=anz57KgqGQKwEjtVO0BTIDj1GKqtnE6ffYTbrFz9hUWk65fbPKoKsujoDriYeNABU7 X4HMKSeqJYHCxdxrfUOVsKZhyGKFjkUpV2f+N+GUdRlPEKoy4kXY1m51oh73p1FvCTxV fGUuj62BUOQTLJ05BslF9sKXUb5q5QrZIZOMtK/iB2nrXLXrrW3EQRJf/WESa4AYQhFd I4MhbSw3UxMdwdlSQXz7AN0X+Y+/pr781gCb727TKB9NP/fCG49F36L+3KQURtQyA6yn fWB7YV+VeI7PqlJTQ2GOuTa9eKUy2MCjF68iQZlGug7J7dTjhOK1/DVzgpNsZD9rRZed xhBA== 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:message-id:date :subject:cc:to:from:sender:dkim-signature:dkim-signature; bh=nlYbNkEStGyoEKyc+LPID8ig2muGjgDR27FoKfyaY4g=; fh=byqoZYyGIF5nyUrxbqMCSaBgugTQ0N3rC9IbdDbCkgM=; b=IRr2KJVLbWWkfPskcfGNAnwWDsTK/ga/6yMsEYGtiQa9HqBL12OHhfVcZnxUgwa95G pCri/X6KMDZMjb2KpQ72vZJV7Jnj4MZIV5TXNvpMHtOuJeiHedKwPgW+Cns101YV7864 w9VjWRu2UV6AbttaD8Hrv1tqeE1rWWNd4HuRDQc4MFIXoxzw0Ww+FVIOoPRi0E8h/DFB RCWn8vIL73H7pmY/xBjHD41GWvUhsGq4yAQDXx1LZ5WbGLllTZTjKpa8t0tZBsUFUCVm YLSQZtY/4OPvVIIy9SNvsuaX5CVBMdYqi+fH5/+fSgyMaqCMkrxzrYv1wT0cwYKe4oV1 vung== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gereZ9q7; spf=pass (google.com: domain of marcus.folkesson@gmail.com designates 2a00:1450:4864:20::22a as permitted sender) smtp.mailfrom=marcus.folkesson@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1706894323; x=1707499123; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=nlYbNkEStGyoEKyc+LPID8ig2muGjgDR27FoKfyaY4g=; b=dZgGCENMdi2B4sjhB/bilQuvin35kNHwKdMv6ZcTL60pRLZcFKU0dUg6L7e2QjbZPC aNUjbuQcqdZP92XrPwCO4Xh8o8CFDf8EwO9WiNR+GsgjAtx5q8G7mMKJDKwfF4xGHzMg H1dz3xj7nlpoHFvyKCwFfE3+SYtv2YYnrvqdBBn7B+9Gqf2spD0nVs4GPmwPkU90CCcl OHco1TqXQjvBILLAcEfnHkYUWBpXYrmkGYA7RcgMTT767CKid/bqdWo1PEz7ZoxeaAhT qeJTYB46tD0tjNqEMLOljNXrr+VmXoVrUtatxWUnbabGBkScI6SccRFuHhZ8xqllBGCg +N5A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706894323; x=1707499123; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=nlYbNkEStGyoEKyc+LPID8ig2muGjgDR27FoKfyaY4g=; b=ZZA65w3I9QFNhkSGQuiYQfERCdXilwmoDHN7eiG00Sp7CSVw6hYYBAJi2OoW6Ieyb5 6QBO30+mKLbTRJDF9JWBhKtUvC/LowZABudoGyN2hmFtUkNNV0UcTj8x9qVrFp8Tfeh4 anqKWF83816+jZuzdoiMmiiXZtXDnAxDWLS/R07n/ZKLF8tQRanCZmPfHLF86JZuP+IO eBj15miu2VcrImdiivm4tGmBMMG9+VC/Mzsyn+N5dhbnpORQ1n+CmU8USbPHpnorAZHB DwgpnVsxstdH743XCR65dXG37FqI3GZSqU1Oc1J7tyKO6eRHHLk2n6mqQh3M6J5a+2Vv MuTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706894323; x=1707499123; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=nlYbNkEStGyoEKyc+LPID8ig2muGjgDR27FoKfyaY4g=; b=UhYyXw9ZZJNeORXwiskBgZUvCt7cN5JdJxOE2jsiv6Zi2i6PpRnahXiW//U9O1ON78 hytQvDlh/jYdh9/H6fAp0dQjZRlvlAsMqojLS9IoSo2yXarmVu5d7wYzwbAEJrkKpkhJ pxYEu88C4tzvSr1alFn3Mm+49POJNIlyXpBT1vLVtKUbTyYv7toZdYl9YhBaIy4P2v8L VayvS9WQVk4biKYj15XdOXfZf5+aIcXZsbMGBh8tKQR04mrfnhk5gcDwEmhX3r253qBi PDcWvXb8zE1hJxYD/u/2PzYL3V/kO71m8DRwAwHOoH4X2X4sLhuF5B+JQUQx9jOASSPq RZPQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0YyFUUESINVf+dFkihfGN8BhHyIqCOLTp9qisJe5mEpeWnczLMmo F4t2WNHDguL9H35gwGc28xxvwYEIdgWTaaBQhbWzk0O92ML5t5ZE X-Google-Smtp-Source: AGHT+IFpFg6sthqdbB7cLxgqfwilt8c6hVXDe1WOgGbbZEvkepK+jiYt++r0DNtjwB+2AvlRT1GBMA== X-Received: by 2002:a2e:854f:0:b0:2d0:89fe:df7f with SMTP id u15-20020a2e854f000000b002d089fedf7fmr1322909ljj.13.1706894322160; Fri, 02 Feb 2024 09:18:42 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:9881:0:b0:2cf:1ec4:df3 with SMTP id b1-20020a2e9881000000b002cf1ec40df3ls391434ljj.2.-pod-prod-08-eu; Fri, 02 Feb 2024 09:18:39 -0800 (PST) X-Received: by 2002:a2e:a591:0:b0:2d0:4c41:695 with SMTP id m17-20020a2ea591000000b002d04c410695mr6729250ljp.37.1706894319344; Fri, 02 Feb 2024 09:18:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706894319; cv=none; d=google.com; s=arc-20160816; b=G9av4sNBD1pUlBTo/YvNamJPKNZuhp5etVuQsGOnpmAI6oHoOu3J3qNgDmaw2w9lKh 9ZF9dWyL97kmbs19En5v2qoC5vsm+98O3Vs5atL31U5NQxEUwJqIWxQJpPeG9kfrk2vu rGY/XOamQrc6exwrxedypvCxERcGLmM/iMnb/A74rfE9XMMonQvM5Owkl8Q139G6K3Cj vQ6THJXlIwyIBxEx6wwue8XmMDmZdEtJNgKm1fbSNFhro9Cbliui1G62roXfJ3HCFe8O xUSbops7k4pNfJctfFHMHrxKckO2XGvTarTGOC+obnDbJ8XIdYWgVkg+iSV2Itrkn6nf LPOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Rw3VfIJCXeYW77ptRFdTZThe4NBF45uz+dWjOwLKo60=; fh=byqoZYyGIF5nyUrxbqMCSaBgugTQ0N3rC9IbdDbCkgM=; b=tIj2QISrn+HBU4wnNL+b0t8xeGrweC2enDi+8QNvctmHk0xKN4Uv451BYeloFgOC6p Wa8/fd1b+4RbHJV05f9DlxAhaqHNgElSXtYkMIQdVH1ruFuz3j6A6phzLYaODdgss2Ew nTxsvIbsEj84UDRO+MULx0gYX47lE9V6wSTB+d4udpATooKZvucEZZaHKrziEOVsC2SW ebxhclhI4CXepwhYdYacppSIdSOflGDUXVdd4ulKo2IIdKOQhU851m7bg1cyFYYMKrHZ LOeFoOAtnL+uzz3Dx8ncPl8mcpi+otQjiMeO5LMgBZRTGusWLhVQMq4ag0YqOPFYAz9u Bb9Q==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gereZ9q7; spf=pass (google.com: domain of marcus.folkesson@gmail.com designates 2a00:1450:4864:20::22a as permitted sender) smtp.mailfrom=marcus.folkesson@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com. [2a00:1450:4864:20::22a]) by gmr-mx.google.com with ESMTPS id d17-20020a2e3611000000b002cf2d9ccc7fsi90776lja.5.2024.02.02.09.18.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Feb 2024 09:18:39 -0800 (PST) Received-SPF: pass (google.com: domain of marcus.folkesson@gmail.com designates 2a00:1450:4864:20::22a as permitted sender) client-ip=2a00:1450:4864:20::22a; Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cf4a22e10dso27914751fa.3 for ; Fri, 02 Feb 2024 09:18:39 -0800 (PST) X-Received: by 2002:a05:651c:103a:b0:2d0:8be6:8cd3 with SMTP id w26-20020a05651c103a00b002d08be68cd3mr1124716ljm.29.1706894318318; Fri, 02 Feb 2024 09:18:38 -0800 (PST) Received: from localhost.localdomain (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id t16-20020a2e7810000000b002d0917d8f36sm56099ljc.111.2024.02.02.09.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 09:18:37 -0800 (PST) From: Marcus Folkesson To: swupdate@googlegroups.com Cc: marcus.folkesson@gmail.com Subject: [swupdate] [PATCH] archive handler: check return value from newlocale() Date: Fri, 2 Feb 2024 18:23:30 +0100 Message-ID: <20240202172330.1788738-1-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Original-Sender: Marcus.Folkesson@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gereZ9q7; spf=pass (google.com: domain of marcus.folkesson@gmail.com designates 2a00:1450:4864:20::22a as permitted sender) smtp.mailfrom=marcus.folkesson@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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: , In case that the system does not support locales, swupdate will end up with a segmentation fault upon freelocale(). Do not consider this to be critical, IOW proceed with the installation but inform the user by an error in the log. Signed-off-by: Marcus Folkesson Reviewed-by: Stefano Babic --- handlers/archive_handler.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/handlers/archive_handler.c b/handlers/archive_handler.c index c19e991..f973a27 100644 --- a/handlers/archive_handler.c +++ b/handlers/archive_handler.c @@ -107,7 +107,11 @@ extract(void *p) * https://github.com/libarchive/libarchive/wiki/Filenames */ archive_locale = newlocale(LC_CTYPE_MASK, "", (locale_t)0); - old_locale = uselocale(archive_locale); + if (archive_locale == 0) { + ERROR("newlocale(): %s", strerror(errno)); + } else { + old_locale = uselocale(archive_locale); + } #endif a = archive_read_new(); @@ -210,8 +214,10 @@ out: free(FIFO); #ifdef CONFIG_LOCALE - uselocale(old_locale); - freelocale(archive_locale); + if (archive_locale != 0) { + uselocale(old_locale); + freelocale(archive_locale); + } #endif data->exitval = exitval; pthread_exit(NULL);