OSDN Git Service

Give xstrncpy() a more informative error message.
authorRob Landley <rob@landley.net>
Sat, 2 Nov 2013 19:24:54 +0000 (14:24 -0500)
committerRob Landley <rob@landley.net>
Sat, 2 Nov 2013 19:24:54 +0000 (14:24 -0500)
lib/xwrap.c

index fdd2db4..98b4300 100644 (file)
@@ -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);
 }