Skip to content

Commit 1db0076

Browse files
committed
[netbsd] skip file name validation in LTbasic2
1 parent 070bb2b commit 1db0076

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/LTbasic2.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,17 @@ int main(int argc, char **argv) {
117117
}
118118
} else if (f->fd_type == LSOF_FD_NUMERIC) {
119119
/* check if fd matches */
120-
if (f->fd_num == fd && f->name &&
121-
strstr(f->name, "LTbasic2-tmp")) {
120+
if (f->fd_num == fd && f->inode == tmp_stat.st_ino &&
121+
f->dev == tmp_stat.st_dev) {
122+
#ifdef NETBSDV
123+
/* on NetBSD, the file path for new created file may be
124+
* unavailable, skip validation */
122125
fd_found = 1;
126+
#else
127+
if (f->name && strstr(f->name, "LTbasic2-tmp")) {
128+
fd_found = 1;
129+
}
130+
#endif
123131
}
124132
}
125133
}
@@ -149,4 +157,4 @@ int main(int argc, char **argv) {
149157
}
150158
}
151159
return 0;
152-
}
160+
}

0 commit comments

Comments
 (0)