provide more info on decoding errors.

This commit is contained in:
christos 2009-04-13 03:38:15 +00:00
parent ccc328a5e1
commit f42cbba55c

View File

@ -1,4 +1,4 @@
/* $NetBSD: utmp_update.c,v 1.8 2008/04/28 20:23:04 martin Exp $ */
/* $NetBSD: utmp_update.c,v 1.9 2009/04/13 03:38:15 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: utmp_update.c,v 1.8 2008/04/28 20:23:04 martin Exp $");
__RCSID("$NetBSD: utmp_update.c,v 1.9 2009/04/13 03:38:15 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -57,6 +57,7 @@ main(int argc, char *argv[])
struct passwd *pwd;
struct stat st;
int fd;
int res;
uid_t euid, ruid;
char tty[MAXPATHLEN];
@ -79,8 +80,9 @@ main(int argc, char *argv[])
if ((utx = malloc(len)) == NULL)
err(1, NULL);
if (strunvis((char *)utx, argv[1]) != sizeof(*utx))
errx(1, "Decoding error");
res = strunvis((char *)utx, argv[1]);
if (res != (int)sizeof(*utx))
errx(1, "Decoding error %s %d != %zu", argv[1], res, sizeof(*utx));
switch (utx->ut_type) {
case USER_PROCESS: