Blob Blame History Raw
diff -up a2ps-4.14/lib/pathwalk.c.forward-null a2ps-4.14/lib/pathwalk.c
--- a2ps-4.14/lib/pathwalk.c.forward-null	2011-08-10 16:06:53.185942197 +0100
+++ a2ps-4.14/lib/pathwalk.c	2011-08-10 16:08:36.831030924 +0100
@@ -348,12 +348,12 @@ xpw_find_included_file (char * const *pa
     /* Relative.  Give its root. */
     dir = dir_name (including_file);
 
-  res = ALLOCA (char, (strlen (dir)
+  res = ALLOCA (char, ((dir ? strlen (dir) : 0)
 		       + strlen (name)
 		       + (suffix ? strlen (suffix) : 0)
 		       + 2));
-  sprintf (res, "%s%c%s%s", dir, DIRECTORY_SEPARATOR,
-	   name, suffix ? suffix : "");
+  sprintf (res, "%s%c%s%s", dir ? dir : "", DIRECTORY_SEPARATOR,
+	   dir ? name : name + 1, suffix ? suffix : "");
   XFREE (dir);
   if (stat (res, &statbuf) == 0)
     return xstrdup (res);