]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core,format-table: use strna/ersatz for formatting fdstore dump 30628/head
authorMike Yuan <me@yhndnzj.com>
Sun, 24 Dec 2023 01:11:48 +0000 (09:11 +0800)
committerMike Yuan <me@yhndnzj.com>
Mon, 25 Dec 2023 09:47:18 +0000 (17:47 +0800)
Currently, the code doesn't handle anonymous inodes correctly.

src/core/service.c
src/shared/format-table.c

index 7bd4e99b11fb64f97cb873debcb41204e09dc0d7..495b183321257507f6c7f80d5ed75aca742dedfa 100644 (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)));
         }
 }
 
index 41471dade038964162787da96a81af7f5d118c83..572fda4411a2bbe9a7ab88bcad8b0d56a9dacce9 100644 (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))