changeset 1105:1bca28705a87 draft

Give xstrncpy() a more informative error message.
author Rob Landley <rob@landley.net>
date Sat, 02 Nov 2013 14:24:54 -0500
parents e11684e3bbc5
children 30a210bae3e9
files lib/xwrap.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/xwrap.c	Sat Nov 02 14:24:33 2013 -0500
+++ b/lib/xwrap.c	Sat Nov 02 14:24:54 2013 -0500
@@ -12,7 +12,7 @@
 // Strcpy with size checking: exit if there's not enough space for the string.
 void xstrncpy(char *dest, char *src, size_t size)
 {
-  if (strlen(src)+1 > size) error_exit("xstrcpy");
+  if (strlen(src)+1 > size) error_exit("'%s' > %ld bytes", src, (long)size);
   strcpy(dest, src);
 }