From: Matthew Fernandez Date: Wed, 3 Nov 2021 03:53:02 +0000 (-0700) Subject: gvconfig: more precise error messages about config file reading X-Git-Tag: 2.50.0~44^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b18d5fbbbaba0f7e81dffe3fa26173d7838e4fe;p=graphviz gvconfig: more precise error messages about config file reading --- diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c index 57eb956fe..86a9b630f 100644 --- a/lib/gvc/gvconfig.c +++ b/lib/gvc/gvconfig.c @@ -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;