]> granicus.if.org Git - graphviz/commitdiff
gvconfig: more precise error messages about config file reading
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 3 Nov 2021 03:53:02 +0000 (20:53 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 9 Nov 2021 15:10:39 +0000 (07:10 -0800)
lib/gvc/gvconfig.c

index 57eb956fe36663cafe8c5a579dca783ee21942f7..86a9b630f1e5e461b0f2c522fcf1fd0a223041d3 100644 (file)
@@ -604,11 +604,14 @@ void gvconfig(GVC_t * gvc, boolean rescan)
                agerr (AGERR,"failed to open %s for read.\n", gvc->config_path);
                return;
            }
+           else if (config_st.st_size == 0) {
+               agerr(AGERR, "%s is zero sized.\n", gvc->config_path);
+           }
            else {
                config_text = gmalloc((size_t)config_st.st_size + 1);
                sz = fread(config_text, 1, config_st.st_size, f);
                if (sz == 0) {
-                   agerr(AGERR,"%s is zero sized, or other read error.\n", gvc->config_path);
+                   agerr(AGERR, "%s read error.\n", gvc->config_path);
                }
                else {
                    gvc->config_found = TRUE;