core,format-table: use strna/ersatz for formatting fdstore dump

Currently, the code doesn't handle anonymous inodes correctly.
This commit is contained in:
Mike Yuan 2023-12-24 09:11:48 +08:00
parent 2413a0fab4
commit 8ba111463d
No known key found for this signature in database
GPG key ID: 417471C0A40F58B3
2 changed files with 3 additions and 3 deletions

View file

@ -903,12 +903,12 @@ static void service_dump_fdstore(Service *s, FILE *f, const char *prefix) {
"%s%s '%s' (type=%s; dev=" DEVNUM_FORMAT_STR "; inode=%" PRIu64 "; rdev=" DEVNUM_FORMAT_STR "; path=%s; access=%s)\n",
prefix, i == s->fd_store ? "File Descriptor Store Entry:" : " ",
i->fdname,
inode_type_to_string(st.st_mode),
strna(inode_type_to_string(st.st_mode)),
DEVNUM_FORMAT_VAL(st.st_dev),
(uint64_t) st.st_ino,
DEVNUM_FORMAT_VAL(st.st_rdev),
strna(path),
accmode_to_string(flags));
strna(accmode_to_string(flags)));
}
}

View file

@ -2003,7 +2003,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
if (d->mode == MODE_INVALID)
return table_ersatz_string(t);
return inode_type_to_string(d->mode);
return inode_type_to_string(d->mode) ?: table_ersatz_string(t);
case TABLE_DEVNUM:
if (devnum_is_zero(d->devnum))