All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Douwsma <ddouwsma@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Donald Douwsma <ddouwsma@redhat.com>,
	"Darrick J . Wong" <djwong@kernel.org>
Subject: [PATCH 4/4] xfsrestore: untangle inventory unpacking logic
Date: Fri, 14 Oct 2022 18:58:47 +1100	[thread overview]
Message-ID: <20221014075847.2047427-5-ddouwsma@redhat.com> (raw)
In-Reply-To: <20221014075847.2047427-1-ddouwsma@redhat.com>

stobj_unpack_sessinfo returns bool_t, fix logic in pi_addfile so errors
can be properly reported.

Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 restore/content.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/restore/content.c b/restore/content.c
index b3999f9..04b6f81 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -5463,17 +5463,14 @@ pi_addfile(Media_t *Mediap,
 			 * desc.
 			 */
 			sessp = 0;
-			if (!buflen) {
-				ok = BOOL_FALSE;
-			} else {
-			    /* extract the session information from the buffer */
-			    if (stobj_unpack_sessinfo(bufp, buflen, &sessinfo)<0) {
-				ok = BOOL_FALSE;
-			    } else {
+			ok = BOOL_FALSE;
+			/* extract the session information from the buffer */
+			if (buflen &&
+			    stobj_unpack_sessinfo(bufp, buflen, &sessinfo)) {
 				stobj_convert_sessinfo(&sessp, &sessinfo);
 				ok = BOOL_TRUE;
-			    }
 			}
+
 			if (!ok || !sessp) {
 				mlog(MLOG_DEBUG | MLOG_WARNING | MLOG_MEDIA, _(
 				      "on-media session "
-- 
2.31.1


  parent reply	other threads:[~2022-10-14  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  7:58 [PATCH v4 0/4] xfsrestore: fix inventory unpacking Donald Douwsma
2022-10-14  7:58 ` [PATCH 1/4] xfsrestore: fix on-media inventory media unpacking Donald Douwsma
2022-10-14  7:58 ` [PATCH 2/4] xfsrestore: fix on-media inventory stream unpacking Donald Douwsma
2022-10-14  7:58 ` [PATCH 3/4] xfsdump: fix on-media inventory stream packing Donald Douwsma
2022-10-14  7:58 ` Donald Douwsma [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-13  3:15 [PATCH v3 0/4] xfsrestore: fix inventory unpacking Donald Douwsma
2022-10-13  3:15 ` [PATCH 4/4] xfsrestore: untangle inventory unpacking logic Donald Douwsma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221014075847.2047427-5-ddouwsma@redhat.com \
    --to=ddouwsma@redhat.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.