[PATCH] erofs-utils: add missing errors and normalize errors to lower-case

Igor Ostapenko igoreisberg at gmail.com
Sun Jan 30 06:45:32 AEDT 2022


From: Igor Eisberg <igoreisberg at 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 at 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



More information about the Linux-erofs mailing list