=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-find.c,v retrieving revision 1.42 retrieving revision 1.43 diff -c -r1.42 -r1.43 *** src/usr.bin/tmux/cmd-find.c 2017/03/13 10:53:32 1.42 --- src/usr.bin/tmux/cmd-find.c 2017/04/05 10:49:46 1.43 *************** *** 1,4 **** ! /* $OpenBSD: cmd-find.c,v 1.42 2017/03/13 10:53:32 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-find.c,v 1.43 2017/04/05 10:49:46 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott *************** *** 256,264 **** * sessions to those containing that pane (we still use the current * window in the best session). */ ! if (fs->item != NULL && fs->item->client->tty.path != NULL) { RB_FOREACH(wp, window_pane_tree, &all_window_panes) { ! if (strcmp(wp->tty, fs->item->client->tty.path) == 0) break; } } else --- 256,264 ---- * sessions to those containing that pane (we still use the current * window in the best session). */ ! if (fs->item != NULL) { RB_FOREACH(wp, window_pane_tree, &all_window_panes) { ! if (strcmp(wp->tty, fs->item->client->ttyname) == 0) break; } } else *************** *** 1248,1254 **** struct client *c; char *copy; size_t size; - const char *path; /* A NULL argument means the current client. */ if (item != NULL && target == NULL) { --- 1248,1253 ---- *************** *** 1265,1284 **** if (size != 0 && copy[size - 1] == ':') copy[size - 1] = '\0'; ! /* Check path of each client. */ TAILQ_FOREACH(c, &clients, entry) { ! if (c->session == NULL || c->tty.path == NULL) continue; ! path = c->tty.path; ! ! /* Try for exact match. */ ! if (strcmp(copy, path) == 0) break; ! /* Try without leading /dev. */ ! if (strncmp(path, _PATH_DEV, (sizeof _PATH_DEV) - 1) != 0) continue; ! if (strcmp(copy, path + (sizeof _PATH_DEV) - 1) == 0) break; } --- 1264,1283 ---- if (size != 0 && copy[size - 1] == ':') copy[size - 1] = '\0'; ! /* Check name and path of each client. */ TAILQ_FOREACH(c, &clients, entry) { ! if (c->session == NULL) continue; ! if (strcmp(copy, c->name) == 0) break; ! if (*c->ttyname == '\0') continue; ! if (strcmp(copy, c->ttyname) == 0) ! break; ! if (strncmp(c->ttyname, _PATH_DEV, (sizeof _PATH_DEV) - 1) != 0) ! continue; ! if (strcmp(copy, c->ttyname + (sizeof _PATH_DEV) - 1) == 0) break; }