diff src/doprnt.c @ 50:ee648375d8d6 r19-16b91

Import from CVS: tag r19-16b91
author cvs
date Mon, 13 Aug 2007 08:56:41 +0200
parents 0293115a14e9
children 8b0bdfdf0cf0
line wrap: on
line diff
--- a/src/doprnt.c	Mon Aug 13 08:56:06 2007 +0200
+++ b/src/doprnt.c	Mon Aug 13 08:56:41 2007 +0200
@@ -445,6 +445,15 @@
 	  if (!largs)
 	    {
 	      string = Dynarr_at (args, spec->argnum - 1).bp;
+	      /* error() can be called with null string arguments.
+		 E.g., in fileio.c, the return value of strerror()
+		 is never checked.  We'll print (null), like some
+		 printf implementations do.  Would it be better (and safe)
+		 to signal an error instead?  Or should we just use the 
+                 empty string?  -dkindred@cs.cmu.edu 8/1997
+	       */
+	      if (!string)
+		string = "(null)";
 	      string_len = strlen ((char *) string);
 	    }
 	  else