1--- src/man.c.orig	2013-03-28 17:44:53.000000000 -0700
2+++ src/man.c	2013-03-28 18:08:58.000000000 -0700
3@@ -427,11 +427,13 @@
4 add_directive (const char *d, const char *file, char *buf, int buflen) {
5      if ((d = getval(d)) != 0 && *d) {
6 	  if (*buf == 0) {
7-	       if (strlen(d) + strlen(file) + 2 > buflen)
8+	       if (strlen(d) + strlen(file) + 2 + 2 > buflen) // 2 extra for the single quotes
9 		    return;
10 	       strcpy (buf, d);
11 	       strcat (buf, " ");
12-	       strcat (buf, file);
13+	       char *fileq = my_xsprintf("'%Q'", file);
14+	       strcat (buf, fileq);
15+	       free(fileq);
16 	  } else {
17 	       if (strlen(d) + strlen(buf) + 4 > buflen)
18 		    return;
19