Skip to content

Commit f3aa3f1

Browse files
committed
get_process_ttyname() now returns a dev_t, not a string.
1 parent e9e0096 commit f3aa3f1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/regress/ttyname/check_ttyname.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
sudo_dso_public int main(int argc, char *argv[]);
4141

4242
int sudo_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
43-
extern char *get_process_ttyname(char *name, size_t namelen);
43+
extern dev_t get_process_ttyname(char *name, size_t namelen);
4444

4545
static int
4646
match_ttys(const char *tty1, const char *tty2)
@@ -67,9 +67,10 @@ int
6767
main(int argc, char *argv[])
6868
{
6969
char *tty_libc = NULL, *tty_sudo = NULL;
70+
int ch, errors = 0, ntests = 1;
7071
char pathbuf[PATH_MAX];
7172
bool verbose = false;
72-
int ch, errors = 0, ntests = 1;
73+
dev_t ttydev;
7374

7475
initprogname(argc > 0 ? argv[0] : "check_ttyname");
7576

@@ -85,7 +86,8 @@ main(int argc, char *argv[])
8586
}
8687

8788
/* Lookup tty name using kernel info if possible. */
88-
if (get_process_ttyname(pathbuf, sizeof(pathbuf)) != NULL)
89+
ttydev = get_process_ttyname(pathbuf, sizeof(pathbuf));
90+
if (ttydev != (dev_t)-1)
8991
tty_sudo = pathbuf;
9092

9193
#if defined(HAVE_KINFO_PROC2_NETBSD) || \

0 commit comments

Comments
 (0)