Skip to content

Commit 4308799

Browse files
authored
Merge pull request #352 from kurok/fix-truncated-fd-in-field-output
Fix truncated fd numbers in -F field output
2 parents 761ca77 + 601e85f commit 4308799

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/print.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ static int printinaddr(struct lsof_context *ctx) {
11101110
*/
11111111
if (nl < 2)
11121112

1113-
addr_too_long :
1113+
addr_too_long:
11141114

11151115
{
11161116
(void)snpf(Namech, Namechl, "network addresses too long");
@@ -1892,8 +1892,12 @@ int print_proc(struct lsof_context *ctx) {
18921892
lc = st = 0;
18931893
if (FieldSel[LSOF_FIX_FD].st) {
18941894

1895-
fd_to_string(Lf->fd_type, Lf->fd_num, fd);
1896-
(void)printf("%c%s%c", LSOF_FID_FD, fd, Terminator);
1895+
if (Lf->fd_type == LSOF_FD_NUMERIC)
1896+
(void)printf("%c%d%c", LSOF_FID_FD, Lf->fd_num, Terminator);
1897+
else {
1898+
fd_to_string(Lf->fd_type, Lf->fd_num, fd);
1899+
(void)printf("%c%s%c", LSOF_FID_FD, fd, Terminator);
1900+
}
18971901
lc++;
18981902
}
18991903
/*

0 commit comments

Comments
 (0)