From f42cbba55cef5e23fbb22d9f1ca8d47b3f0b9e23 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 13 Apr 2009 03:38:15 +0000 Subject: [PATCH] provide more info on decoding errors. --- libexec/utmp_update/utmp_update.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libexec/utmp_update/utmp_update.c b/libexec/utmp_update/utmp_update.c index 3e88e1bcc095..b2dba0673ed4 100644 --- a/libexec/utmp_update/utmp_update.c +++ b/libexec/utmp_update/utmp_update.c @@ -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 -__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 #include @@ -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: