share/gui: don't use less of widget width for truncation than available
[neverball] / share / common.c
index 3da15c9..3818202 100644 (file)
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <errno.h>
 #include <time.h>
 #include <ctype.h>
 #include <stdarg.h>
@@ -256,7 +255,7 @@ char *base_name(const char *name, const char *suffix)
 
     base = path_last_sep(name);
 
-    strncpy(buf, base ? base + 1 : name, sizeof (buf));
+    strncpy(buf, base ? base + 1 : name, sizeof (buf) - 1);
 
     /* Remove the suffix. */