forked from pool/ocfs2-tools
c57803101a
- libo2dlm: Close file description after use + 0001-libo2dlm-Close-file-description-after-use.patch - debugfs.ocfs2: Fix a bug in process_open_args() + 0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch - Update ocfs2-tools.tar.bz2 to upstream v1.8.4 - Use new ocfs2-tools git URL https://github.com/markfasheh/ocfs2-tools.git - Drop patches (merged upstream): - 0001-Use-cmap-for-getting-cluster-name.patch - 0002-Remove-controld-dependency-in-group_join-leave.patch - 0003-Auto-setup-cluster_stack-based-on-what-is-on-disk.patch - 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch - 0005-mkfs-Setup-cluster_stack-if-not-setup-based-on-what-.patch - 0006-Auto-setup-pcmk-stack-as-default-if-no-stack-is-setu.patch OBS-URL: https://build.opensuse.org/request/show/305879 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=82
74 lines
1.9 KiB
Diff
74 lines
1.9 KiB
Diff
From 41057a7eef9da9d77cde46d336a7f8a19564d7f8 Mon Sep 17 00:00:00 2001
|
|
From: piaojun <piaojun@huawei.com>
|
|
Date: Wed, 6 May 2015 10:25:10 +0800
|
|
Subject: [PATCH 2/2] debugfs.ocfs2: Fix a bug in process_open_args()
|
|
|
|
In process_open_args(), 'dev' get the wrong value because getopt() will
|
|
change the value of args[1]. This problem will cause failure in
|
|
debugfs.ocfs2. ocfs2. So we should assign 'dev' before getopt().
|
|
|
|
This fix fixes the bug introduced in 9693851641bfcd0f2bab226e9f03d9ab05cb7edf
|
|
|
|
Signed-off-by: Jun Piao <piaojun@huawei.com>
|
|
Reviewed-by: Alex Chen <alex.chen@huawei.com>
|
|
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
|
Reported-by: Gang He <ghe@suse.com>
|
|
---
|
|
debugfs.ocfs2/commands.c | 20 +++++++++++++-------
|
|
1 file changed, 13 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
|
|
index 1b0b2d9..6da396a 100644
|
|
--- a/debugfs.ocfs2/commands.c
|
|
+++ b/debugfs.ocfs2/commands.c
|
|
@@ -534,6 +534,7 @@ static int process_open_args(char **args,
|
|
int num, argc, c;
|
|
|
|
for (argc = 0; (args[argc]); ++argc);
|
|
+ dev = strdup(args[1]);
|
|
optind = 0;
|
|
while ((c = getopt(argc, args, "is:")) != EOF) {
|
|
switch (c) {
|
|
@@ -544,26 +545,31 @@ static int process_open_args(char **args,
|
|
s = strtoul(optarg, &ptr, 0);
|
|
break;
|
|
default:
|
|
- return 1;
|
|
+ ret = 1;
|
|
+ goto bail;
|
|
break;
|
|
}
|
|
}
|
|
|
|
- if (!s)
|
|
- return 0;
|
|
+ if (!s) {
|
|
+ ret = 0;
|
|
+ goto bail;
|
|
+ }
|
|
|
|
num = ocfs2_get_backup_super_offsets(NULL, byte_off,
|
|
ARRAY_SIZE(byte_off));
|
|
- if (!num)
|
|
- return -1;
|
|
+ if (!num) {
|
|
+ ret = -1;
|
|
+ goto bail;
|
|
+ }
|
|
|
|
if (s < 1 || s > num) {
|
|
fprintf(stderr, "Backup super block is outside of valid range"
|
|
"(between 1 and %d)\n", num);
|
|
- return -1;
|
|
+ ret = -1;
|
|
+ goto bail;
|
|
}
|
|
|
|
- dev = strdup(args[1]);
|
|
ret = get_blocksize(dev, byte_off[s-1], &blksize, s);
|
|
if (ret) {
|
|
com_err(args[0],ret, "Can't get the blocksize from the device"
|
|
--
|
|
2.1.2
|
|
|