From fd3958b61c5f1c7ed520f07553b999af5522d8e0 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Mon, 10 Jun 2019 12:29:06 -0400 Subject: [PATCH] LU-12396 utils: lfs should not output 'nul' char If lfs prints a nul char, it breaks parsing of the output. Fixes: 68635c3d9b31 ("LU-11963 osd: Add nonrotational flag to statfs") Signed-off-by: Yang Sheng Signed-off-by: Patrick Farrell Change-Id: Ibfa77920adf3a6c62b01efb005d02ca81db7f7c1 --- lustre/utils/lfs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 701868a..fcd1b4c 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -4897,9 +4897,6 @@ static char obd_statfs_state_names[] = { static char obd_statfs_state2char(int s) { - /* Not an error state, do not print here */ - if (s == OS_STATE_NONROT) - return '\0'; /* Unknown name */ if (s > ARRAY_SIZE(obd_statfs_state_names)/sizeof(char) || obd_statfs_state_names[s] == 0) @@ -4987,7 +4984,7 @@ static int showdf(char *mntdir, struct obd_statfs *stat, printf(" "); for (i = 0, state = stat->os_state; state != 0; i++) { uint32_t mask = 1 << i; - if (!(state & mask)) + if (!(state & mask) || mask == OS_STATE_NONROT) continue; printf("%c", obd_statfs_state2char(mask)); state &= ~mask; -- 1.8.3.1