Message ID | 20241030163957.2822282-9-stefano.babic@swupdate.org |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBD2ZDGN6SEKRBYWCRG4QMGQEPF2WGAI@googlegroups.com> 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=MNCCTPco; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33a; helo=mail-wm1-x33a.google.com; envelope-from=swupdate+bncbd2zdgn6sekrbywcrg4qmgqepf2wgai@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-wm1-x33a.google.com (mail-wm1-x33a.google.com [IPv6:2a00:1450:4864:20::33a]) (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 4XdtCF33Lgz1xxw for <incoming@patchwork.ozlabs.org>; Thu, 31 Oct 2024 03:40:08 +1100 (AEDT) Received: by mail-wm1-x33a.google.com with SMTP id 5b1f17b1804b1-4314a22ed8bsf136585e9.1 for <incoming@patchwork.ozlabs.org>; Wed, 30 Oct 2024 09:40:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730306404; cv=pass; d=google.com; s=arc-20240605; b=YQWB+QP+MrGhkdDH9hMPu8DUK7t07luSeqNzOt1QIc74WXZElgJasLMc9p3lfrls5A sbTI0+e1KX90gBVAgT4p7otcfJxa90aO35bgTodyRfA7C5HrjLUKlY28lAk3tND4HJXj KbgXVrzAHQk0POln+aWMteY7CZU3IjLoxc34WR8cqoZXtrrAGgSdS1uEUqKVW109C5wd Bo+BvdMbnjMZyKCjf9QinWmG8qJsPlkOCXIzSRVFw+dlT0TS/afuQF2biCCweNRPMvNc k1urN4i8gEAcx9CgGk46zuyE2gPVXOKUTq/IxVy/N5rBma+fpCD5IqtDH31W6UBHbVpl yQlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=w+AGGW15q4NheW8IZVA9lfb9rHgRE6xZDOwTLa7hs8I=; fh=CnVZU4IbodD2nUWzu4OOjwTfn74dkqNCTolQQrUDqzY=; b=Buuvs7c9QkMp4x4vdMlgB0taOtzmEMYmylValPHHkpP2WDSg5mIfwNlF0umLlNRzNH hMSt0vaeXUe6WkTE3cqpqhsZIAWmTGNvybZ2iCvKP6O+zQP4gbovN2dZxWJdOg0EX8lP cENKJw++xOOhBkxkaNtTgJrnNVeI6ZABvaK0kwNqc07VtDtwLWAO16uduVXNuL5dUes5 Y6THyRB9v1LqhkMB/V3v9loM46pBDr25ufRMEJf67paLHMjrqSl0IqSEbAEbI7yFElJ7 L1kuv6i+UWQPFCtwnIfo6bk7QuWgdtlltperse4nQe4r9ZZhxFml51m8iqLMYub3um8o vOuA==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=DF3gTM5I; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1730306404; x=1730911204; 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:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=w+AGGW15q4NheW8IZVA9lfb9rHgRE6xZDOwTLa7hs8I=; b=MNCCTPcoaw4eHILDSUgUdDDLFMxx6KOVY+23lDTaf2gvszmDzUbMzx/cOXVNjFnUFJ d/q5vdpy1RsX0AP+CD8HAfXl+YaEtDdGjrZhua3cXsY6AOxtLY7DFNCeB9gFpYgCSdqZ vkByfMs0iWPeDbAFgyAsFCm1MIJgHCevnkF8gzslsrbU09/Dc2Tpz9oVk2EGyCl9jedf RMumxNt329ITcakFU36+/rxwly8HXtGbPgemBNKWHZpcs7Yeo1U6s4qNMj9atd1/vgvF ZChNk4nBV1bdaXSbrTpDcyWf8J7+94Do7nJxoVOP3/pBKwr9Muv6Gk1+WWrsrqAoRF3J wJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730306404; x=1730911204; 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 :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=w+AGGW15q4NheW8IZVA9lfb9rHgRE6xZDOwTLa7hs8I=; b=WzJ22kcnMMcfbhSJN9/iEWrJdVmRL6Z3MCQTlTVbD/WtpjZSCMuGpLRWRGS+LtKqWJ HCC8GjWpadWJbdFtF3OV0dUlzTzC6dhVsMeNlqtPX3B8TlciiLn5T5N3DR3iJIDF8Iaw ZWuELx35p0NH1LKwX2+J3jlBIrJ5ngXlhZKmODNloQZrWJohGwqaW48RilYG3fixWZUE lzzgqu7t5/R8XSoePOlgVTK4L9ZUEftA+0lKFHrokG5LWnr0WKoKMxG0fjV5Ew1VFuR9 hFm8DgF7g7Vlr1QbuGSq34SN37RMlTE32GND/Dv1nUJ5tK2w73par6gyPryzkxUFGAsz eAtw== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWUY8pz7UgXTBvinmB2KqDiA38v1Wx4kB+yIAvMS4CDrIT6MZd7Sfn5xuyj/vimupX5CxxEyPuGOQ==@patchwork.ozlabs.org X-Gm-Message-State: AOJu0YyPfrub6k+JSvGfiKCX7YTVzSvpI6OR9WSkWuRCJ9wB+dw1LBP9 6V/598DmiGMf6fKN2RHXKtQnpgbWO6vw7QYHef7zAhQBu/QGSMM5 X-Google-Smtp-Source: AGHT+IHQc9gbFHSqvr9jJiecToUoRyA6s3Ig0R4A2q1nDXpabxj6KErmbAV2ogpClGyiFmPu9zDyTg== X-Received: by 2002:a05:600c:3587:b0:42c:c401:6d67 with SMTP id 5b1f17b1804b1-4327b6f464amr2166615e9.6.1730306403893; Wed, 30 Oct 2024 09:40:03 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:59af:0:b0:374:d287:ec15 with SMTP id ffacd0b85a97d-381bea18bc3ls27522f8f.1.-pod-prod-03-eu; Wed, 30 Oct 2024 09:40:00 -0700 (PDT) X-Received: by 2002:a05:600c:4fc3:b0:42c:bae0:f05b with SMTP id 5b1f17b1804b1-4327b6f46c8mr2456125e9.1.1730306400532; Wed, 30 Oct 2024 09:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730306400; cv=none; d=google.com; s=arc-20240605; b=R5OS0paOBt/UMFmX67PK2KsqtwbN036/v7bTQ7+Q30ByVrsYbYGHdlzzVPHPAiBKK8 W/CAd4cSSDz30ZTibAQqfvo4jf38ShHjV4kgjavF+6Wy1XglHZKt8MwmZCYGOa/4Q16D IQ07eMojcTvOxJF3S+3Fwfh9no42yx/Y8FDlJumi78kwuQMTZBiM4Ax/NXpaFvY3ytJT JIW/TAFOXtqCUgPOh/20aIb22VnnIdF2xPSuJYCIaytjfLT+QjZGUiXXUeutUdCq+Y2i z3I8tfSRPO3plePPbIPsbp2rm1YRX/YBkP/gPY/ZfDQLFtlcDWIjNL6H6cNMgcr5b3yH w2Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=UIGtRzWZrnO9DuLoNZCcnZhKGZAX4HDjnkHQPjonvq8=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=QN5GIn5oJ7qatCmtas0xbV2/bYJoPhZPxTx15Xo6V6Uljp81nbV37pN2qZw9AGKI+r wNzZ9QRjrDaABvZA5RXuruhd2BX34G+qCKIQj9CFKZVqmvk9oFnVEFFPhvwvwRdF7281 wSpL9mjyE8E7LpFWPghNj4/Qt5vgzXTWpINEDnufgEMA514YMo/fkIILYiDMWzBovbvb n97ThmSpmBieyV9YDusZh9uulbcSeHXRRFYoC5P6cTXji4I2TYVPRQiVigX13icJUyp6 3EJt4X4YXwjFyd4PolW+9j852zRhmmCa/FEMghywK9y6M5ZZNtDN3AaMoU51YuuXtLec H3fw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=DF3gTM5I; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.131]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-431b43a99dbsi3056375e9.0.2024.10.30.09.40.00 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 09:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) client-ip=212.227.126.131; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue010 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MAOeB-1szHyd0dlj-000JLH; Wed, 30 Oct 2024 17:40:00 +0100 From: Stefano Babic <stefano.babic@swupdate.org> To: swupdate@googlegroups.com Cc: Stefano Babic <stefano.babic@swupdate.org> Subject: [swupdate] [PATCH V2 08/10] BUG: fix data transfer in callback used by docker Date: Wed, 30 Oct 2024 17:39:55 +0100 Message-Id: <20241030163957.2822282-9-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030163957.2822282-1-stefano.babic@swupdate.org> References: <20241030163957.2822282-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:/Kl/YEUrXibClVsjejDk+RtX6OT/QcLVsRsoUBJP+IE3snIiYKI 8uNzULSXoUj/lzfF+k/NJKE6n91tOEwKz/lVcOFgYUeZj2Wnjfb6/21rViXkFzj6098CTZr lLTAfY1jbwVIG39B6u47jHAgBOnS94edbQTusCUthgC9qJOGgiqCr5ViP/SWHU41w4JCmXG qbn1RHEY/wY2nBhdmaFzw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:LGAJqUGitK8=;FX6lp9XylcQWezWtOsp1R4qK3dq 87bs5y2TrnhuAGXvUxmvwlZdHqO//Ok+6REYvKOn2FaoflxhaEyQFOaQBD0VXC1GaW7lippBl u+5unM5+1t1Qo1LNMQXXYpYX2U5lj+TgPdwfNmk3S2r7Ym5mDOsCOV9C0upZuQAg6R7U6rudY BduRpuGoEOdCUkzEVrbYr8WXsbvZewIZeHhdejnAhWAYas9JvGZWKiNc0kOUIiI0XOB4QPPg/ MBlNiS1hxZQxCmXrFM4fWSNTT+w5caRRAZBeQlA8MWJcW9ntgCAMwTH2crwRNZo3bqzeFzWtV 5suiw/U234ayxRaXLef7yb63iE0+QOxR2Lcw581xSHCxtYpKBQer2mHMI2K1EmdWsiUhAeXOK E2IIhvRgxjXi9wQe/NUgPcAOEbn0oRM47xjFVDrRI6H3cVQK85LBpyVpBDovMWyqmaFf2fsOT J2eKTNv1FCFN4efDHyC5Vzkxzii8ooemuJ0WJhjiweTSLs5ADNRW0k46SV0luIqRy7oaJTupq ugEmW+HpCWayDs3qUAAC43nyehOwS+/tvAva3UWBylVDwC/dZomm/ftNoGQpLOlVb10YGzFC8 vdmpWD2ltHTxGpAEzi/X02RhcGYBoJhTg+7DxxJyv6lePFbMbiqfn0e9ETHPiqkwKDLlgdk/F vctzlI+ZVOJW3b8zjzgy11lFqA/MfQJdGkGtp7hBX5BvhcMdtg2B75TX6B/fQY+l+kg0UEWU6 l31yoyjd6NcnCYP+Mx1z97dmlrbQg4Jnw== X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=DF3gTM5I; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org 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 |
Introduce BTRFS Snapshot Handler
|
expand
|
diff --git a/handlers/handler_helpers.c b/handlers/handler_helpers.c index 5861690a..77467d39 100644 --- a/handlers/handler_helpers.c +++ b/handlers/handler_helpers.c @@ -28,12 +28,12 @@ int handler_transfer_data(void *data, const void *buf, size_t len) { struct hnd_load_priv *priv = (struct hnd_load_priv *)data; - ssize_t written; - unsigned int nbytes = len; - const void *tmp = buf; + size_t nbytes = len; + const char *tmp = buf; - while (nbytes) { - written = write(priv->fifo[FIFO_HND_WRITE], buf, len); + while (nbytes > 0) { + ssize_t written; + written = write(priv->fifo[FIFO_HND_WRITE], tmp, nbytes); if (written < 0) { ERROR ("Cannot write to fifo"); return -EFAULT;
The callback has severe bugs and it works because the write() can be done in a single step. Loop is buggy, and it does not work if multiple write are required to transfer the data. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- handlers/handler_helpers.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.34.1