mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-12-04 01:24:20 +08:00
btrfs-progs: fix XX_flags_to_str() to always end with '\0'
[BUG] We noticed 'btrfs check' outputs something like leaf 30408704 flags 0x0(P1逅?) backref revision 1 but we expected: leaf 30408704 flags 0x0() backref revision 1 [CAUSE] Some XX_flags_to_str() failed to make sure the result string always ends with '\0' in some case. [FIX] Reset the buffer at the beginnig. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Wang Yugui (wangyugui@e16-tech.com) Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
4882a4f5fa
commit
e9a7efb1b6
@ -205,6 +205,7 @@ static void bg_flags_to_str(u64 flags, char *ret)
|
||||
/* Caller should ensure sizeof(*ret)>= 26 "OFF|SCANNING|INCONSISTENT" */
|
||||
static void qgroup_flags_to_str(u64 flags, char *ret)
|
||||
{
|
||||
ret[0] = 0;
|
||||
if (flags & BTRFS_QGROUP_STATUS_FLAG_ON)
|
||||
strcpy(ret, "ON");
|
||||
else
|
||||
@ -412,6 +413,7 @@ static void extent_flags_to_str(u64 flags, char *ret)
|
||||
{
|
||||
int empty = 1;
|
||||
|
||||
ret[0] = 0;
|
||||
if (flags & BTRFS_EXTENT_FLAG_DATA) {
|
||||
empty = 0;
|
||||
strcpy(ret, "DATA");
|
||||
@ -1196,6 +1198,7 @@ static void header_flags_to_str(u64 flags, char *ret)
|
||||
{
|
||||
int empty = 1;
|
||||
|
||||
ret[0] = 0;
|
||||
if (flags & BTRFS_HEADER_FLAG_WRITTEN) {
|
||||
empty = 0;
|
||||
strcpy(ret, "WRITTEN");
|
||||
|
Loading…
Reference in New Issue
Block a user