Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Ostapenko <igoreisberg@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: Igor Eisberg <igoreisberg@gmail.com>
Subject: [PATCH] erofs-utils: add missing errors and normalize errors to lower-case
Date: Sat, 29 Jan 2022 21:45:32 +0200	[thread overview]
Message-ID: <20220129194532.26-1-igoreisberg@gmail.com> (raw)
In-Reply-To: <YfT1Hdr4w6pQKgeA@B-P7TQMD6M-0146.local>

From: Igor Eisberg <igoreisberg@gmail.com>

Had second thoughts about this change I made, because it's making
an assumption about the default value of extract_pos (being 0).

Signed-off-by: Igor Ostapenko <igoreisberg@gmail.com>
---
 fsck/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index 3be5d66..e669b44 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -136,9 +136,10 @@ static int erofsfsck_parse_options_cfg(int argc, char **argv)
 					return -ENOMEM;
 				strncpy(fsckcfg.extract_path, optarg, len);
 				fsckcfg.extract_path[len] = '\0';
-				/* update position only if path is not root */
-				if (len > 1 || fsckcfg.extract_path[0] != '/')
-					fsckcfg.extract_pos = len;
+				/* if path is root, start writing from position 0 */
+				if (len == 1 && fsckcfg.extract_path[0] == '/')
+					len = 0;
+				fsckcfg.extract_pos = len;
 			}
 			break;
 		case 3:
-- 
2.30.2


  parent reply	other threads:[~2022-01-29 19:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 13:22 [PATCH] erofs-utils: add missing errors and normalize errors to lower-case Igor Ostapenko
2022-01-29  4:52 ` Gao Xiang
2022-01-29  5:47 ` Igor Eisberg
2022-01-29  5:56   ` Gao Xiang
2022-01-29  6:13     ` Gao Xiang
2022-01-29  6:48       ` Igor Eisberg
2022-01-29  8:04         ` Gao Xiang
2022-01-29 18:22           ` Igor Ostapenko
2022-01-29 19:45           ` Igor Ostapenko [this message]
2022-01-30  0:26             ` Gao Xiang

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=20220129194532.26-1-igoreisberg@gmail.com \
    --to=igoreisberg@gmail.com \
    --cc=linux-erofs@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox