From 6b18d5fbbbaba0f7e81dffe3fa26173d7838e4fe Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 2 Nov 2021 20:53:02 -0700 Subject: [PATCH] gvconfig: more precise error messages about config file reading --- lib/gvc/gvconfig.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.40.0