From: Darrick J. Wong <djwong@xxxxxxxxxx> Fix the backwards boolean logic here, which results in weird behavior. # xfs_db -x -c /dev/sda xfs_db> print fname fname = "\000\000\000\000\000\000\000\000\000\000\000\000" xfs_db> write fname "mo\0h5o" fname = "mo\005o\000\000\000\000\000\000\000\000" xfs_db> print fname fname = "mo\005o\000\000\000\000\000\000\000\000" Notice that we passed in octal-zero, 'h', '5', 'o', but the fs label is set to octal-5, 'o' because of the incorrect loop logic. -Wlogical-op found this one. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- db/write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/write.c b/db/write.c index 70cb0518d0..6c67e839a9 100644 --- a/db/write.c +++ b/db/write.c @@ -479,7 +479,7 @@ convert_oct( if (arg[count] == '\0') break; - if ((arg[count] < '0') && (arg[count] > '7')) + if ((arg[count] < '0') || (arg[count] > '7')) break; } @@ -553,7 +553,7 @@ convert_arg( /* do octal conversion */ if (*ostr == '\\') { - if (*(ostr + 1) >= '0' || *(ostr + 1) <= '7') { + if (*(ostr + 1) >= '0' && *(ostr + 1) <= '7') { ret = convert_oct(ostr + 1, &octval); *rbuf++ = octval; ostr += ret + 1;