Skip to content

Commit 23a7116

Browse files
committed
[darwin] Drop V_path and HASPRIVNMCACHE for darwin dialect, use enter_nm instead
1 parent 0c66a91 commit 23a7116

3 files changed

Lines changed: 4 additions & 20 deletions

File tree

lib/dialects/darwin/dfile.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void enter_vnode_info(
153153
*/
154154
vip->vip_path[sizeof(vip->vip_path) - 1] = '\0';
155155
if (vip->vip_path[0] != '\0') {
156-
Lf->V_path = mkstrcpy(vip->vip_path, (MALLOC_S *)NULL);
156+
enter_nm(ctx, vip->vip_path);
157157
}
158158
/*
159159
* Save node number.
@@ -241,17 +241,6 @@ void err2nm(struct lsof_context *ctx, /* context */
241241
enter_nm(ctx, Namech);
242242
}
243243

244-
/*
245-
* print_v_path() -- print vnode's path
246-
*/
247-
int print_v_path(struct lsof_context *ctx, struct lfile *lf) {
248-
if (lf->V_path) {
249-
safestrprt(lf->V_path, stdout, 0);
250-
return (1);
251-
}
252-
return (0);
253-
}
254-
255244
/*
256245
* process_atalk() -- process an Apple Talk file
257246
*/

lib/dialects/darwin/machine.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,12 @@
218218
*/
219219

220220
# define HASLFILEADD \
221-
char *V_path; \
222221
mach_port_t fileport; \
223222
uint32_t guardflags;
224223
# define CLRLFILEADD(lf) \
225-
if (lf->V_path) { \
226-
(void)free((FREE_P *)lf->V_path); \
227-
lf->V_path = (char *)NULL; \
228-
} \
229224
lf->fileport = MACH_PORT_NULL; \
230225
lf->guardflags = 0;
231226
# define SETLFILEADD \
232-
Lf->V_path = (char *)NULL; \
233227
Lf->fileport = MACH_PORT_NULL; \
234228
Lf->guardflags = 0;
235229

@@ -338,7 +332,7 @@
338332
* returns non-zero if it prints a name to stdout.
339333
*/
340334

341-
# define HASPRIVNMCACHE print_v_path
335+
/* #define HASPRIVNMCACHE <function name> */
342336

343337
/*
344338
* HASPRIVPRIPP is defined for dialects that have a private function for

tests/LTbasic2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ int main(int argc, char **argv) {
9595
}
9696
} else if (f->fd_type == LSOF_FD_NUMERIC) {
9797
/* check if fd matches */
98-
if (f->fd_num == fd && strstr(f->name, "LTbasic2-tmp")) {
98+
if (f->fd_num == fd && f->name &&
99+
strstr(f->name, "LTbasic2-tmp")) {
99100
fd_found = 1;
100101
}
101102
}

0 commit comments

Comments
 (0)