diff mbox series

[5/9] debugfs: allow comment lines in command file

Message ID 1581037786-62789-5-git-send-email-adilger@whamcloud.com
State Accepted
Headers show
Series [1/9] e2fsck: fix e2fsck_allocate_memory() overflow | expand

Commit Message

Andreas Dilger Feb. 7, 2020, 1:09 a.m. UTC
Allow comment lines with '#' at the start of the line in the command
file passed in to debugfs via the "-f" option or from standard input.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197
---
 debugfs/debugfs.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Theodore Ts'o Feb. 29, 2020, 11:32 p.m. UTC | #1
On Thu, Feb 06, 2020 at 06:09:42PM -0700, Andreas Dilger wrote:
> Allow comment lines with '#' at the start of the line in the command
> file passed in to debugfs via the "-f" option or from standard input.
> 
> Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197

Thanks, applied.

					- Ted
diff mbox series

Patch

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 15b0121..60931a9 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -2486,6 +2486,10 @@  static int source_file(const char *cmd_file, int ss_idx)
 	while (!feof(f)) {
 		if (fgets(buf, sizeof(buf), f) == NULL)
 			break;
+		if (buf[0] == '#') {
+			printf("%s", buf);
+			continue;
+		}
 		cp = strchr(buf, '\n');
 		if (cp)
 			*cp = 0;