From: Sascha Wildner Date: Sun, 23 Dec 2018 08:13:58 +0000 (+0100) Subject: : Change struct utmpx's ut_type from uint16_t to short, per POSIX. X-Git-Tag: v5.7.0~663 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/14f65205020a4c38ae02896eea150f3db55eb086 : Change struct utmpx's ut_type from uint16_t to short, per POSIX. See https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/utmpx.h.html Our valid ut_types are 0-8 currently, so there should not be any issues. Also fix a no longer necessary cast in utmp_update. --- diff --git a/include/utmpx.h b/include/utmpx.h index 2cb45d4a73..af766ac90a 100644 --- a/include/utmpx.h +++ b/include/utmpx.h @@ -97,7 +97,7 @@ struct utmpx { char ut_host[_UTX_HOSTSIZE]; /* host name */ uint8_t ut_unused[16]; /* reserved for future use */ uint16_t ut_session; /* session id used for windowing */ - uint16_t ut_type; /* type of this entry */ + short ut_type; /* type of this entry */ pid_t ut_pid; /* process id creating the entry */ struct exit_status ut_exit; /* process termination/exit status */ struct sockaddr_storage ut_ss; /* address where entry was made from */ diff --git a/lib/libc/gen/endutxent.3 b/lib/libc/gen/endutxent.3 index 79477e579d..0bf35ffc77 100644 --- a/lib/libc/gen/endutxent.3 +++ b/lib/libc/gen/endutxent.3 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 20, 2010 +.Dd December 23, 2018 .Dt ENDUTXENT 3 .Os .Sh NAME @@ -131,7 +131,7 @@ struct utmpx { char ut_line[_UTX_LINESIZE]; /* tty name */ char ut_host[_UTX_HOSTSIZE]; /* host name */ uint16_t ut_session; /* session id used for windowing */ - uint16_t ut_type; /* type of this entry */ + short ut_type; /* type of this entry */ pid_t ut_pid; /* process id creating the entry */ struct { uint16_t e_termination; /* process termination signal */ diff --git a/libexec/utmp_update/utmp_update.c b/libexec/utmp_update/utmp_update.c index dcc524f469..f56659ff13 100644 --- a/libexec/utmp_update/utmp_update.c +++ b/libexec/utmp_update/utmp_update.c @@ -85,7 +85,7 @@ main(int argc, char *argv[]) case DEAD_PROCESS: break; default: - errx(1, "Invalid utmpx type %d", (int)utx->ut_type); + errx(1, "Invalid utmpx type %hd", utx->ut_type); } if (ruid != 0) { diff --git a/usr.bin/who/utmpentry.h b/usr.bin/who/utmpentry.h index 421f36ae23..6ebd8937e2 100644 --- a/usr.bin/who/utmpentry.h +++ b/usr.bin/who/utmpentry.h @@ -53,7 +53,7 @@ struct utmpentry { uint16_t term; uint16_t exit; uint16_t sess; - uint16_t type; + short type; struct utmpentry *next; };