]> granicus.if.org Git - graphviz/commitdiff
print strerrno(errno) on failure to open image files, make it easier to see problems...
authorellson <devnull@localhost>
Sat, 15 Mar 2008 12:59:48 +0000 (12:59 +0000)
committerellson <devnull@localhost>
Sat, 15 Mar 2008 12:59:48 +0000 (12:59 +0000)
lib/gvc/gvusershape.c

index ba122d4a2bcf2e297eba3201658c132ead02126f..3585bcae6fb977fa684dab6913953bf54839e705 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stddef.h>
 #include <string.h>
+#include <errno.h>
 
 #include "types.h"
 #include "logic.h"
@@ -361,6 +362,12 @@ static usershape_t *gvusershape_open (char *name)
 #else
            us->f = fopen(fn, "rb");
 #endif
+           if (us->f == NULL) {
+               agerr(AGWARN, "%s while opening %s\n",
+                       strerror(errno), fn);
+               free(us);
+               return NULL;
+           }
        }
         switch(imagetype(us)) {
            case FT_NULL: