tsdump: quiet compiler warnings on some platforms.

Quiet a -Wshadow warning from gcc.
Cast major() and minor() to unsigned int when printing.
This commit is contained in:
Todd C. Miller
2023-11-26 09:27:46 -07:00
parent 288593875d
commit 522f1b634f

View File

@@ -301,12 +301,14 @@ dump_entry(struct timestamp_entry *entry, off_t pos)
if (sudo_timespecisset(&entry->ts)) if (sudo_timespecisset(&entry->ts))
printf("time stamp: %s", ctime(&entry->ts.tv_sec)); printf("time stamp: %s", ctime(&entry->ts.tv_sec));
if (entry->type == TS_TTY) { if (entry->type == TS_TTY) {
char tty[PATH_MAX]; char ttypath[PATH_MAX];
if (sudo_ttyname_dev(entry->u.ttydev, tty, sizeof(tty)) == NULL) { if (sudo_ttyname_dev(entry->u.ttydev, ttypath, sizeof(ttypath)) == NULL) {
printf("terminal: %u, %u (0x%x)\n", major(entry->u.ttydev), printf("terminal: %u, %u (0x%x)\n",
minor(entry->u.ttydev), (unsigned int)entry->u.ttydev); (unsigned int)major(entry->u.ttydev),
(unsigned int)minor(entry->u.ttydev),
(unsigned int)entry->u.ttydev);
} else { } else {
printf("terminal: %s (0x%x)\n", tty, printf("terminal: %s (0x%x)\n", ttypath,
(unsigned int)entry->u.ttydev); (unsigned int)entry->u.ttydev);
} }
} else if (entry->type == TS_PPID) { } else if (entry->type == TS_PPID) {