Module Name:    src
Committed By:   christos
Date:           Mon Apr 13 03:38:15 UTC 2009

Modified Files:
        src/libexec/utmp_update: utmp_update.c

Log Message:
provide more info on decoding errors.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/libexec/utmp_update/utmp_update.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/utmp_update/utmp_update.c
diff -u src/libexec/utmp_update/utmp_update.c:1.8 src/libexec/utmp_update/utmp_update.c:1.9
--- src/libexec/utmp_update/utmp_update.c:1.8	Mon Apr 28 16:23:04 2008
+++ src/libexec/utmp_update/utmp_update.c	Sun Apr 12 23:38:15 2009
@@ -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 @@
 	struct passwd *pwd;
 	struct stat st;
 	int fd;
+	int res;
 	uid_t euid, ruid;
 	char tty[MAXPATHLEN];
 
@@ -79,8 +80,9 @@
 	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:

Reply via email to