$NetBSD: patch-ap,v 1.12 2009/05/17 12:55:52 sno Exp $ --- lib/gvc/gvconfig.c.orig 2009-02-25 17:46:45.000000000 +0000 +++ lib/gvc/gvconfig.c 2009-04-25 18:18:53.000000000 +0000 @@ -543,11 +543,7 @@ } else { f = fopen(gvc->config_path,"r"); - if (!f) { - agerr (AGERR,"failed to open %s for read.\n", gvc->config_path); - exit(1); - } - else { + if (f) { config_text = gmalloc(config_st.st_size + 1); sz = fread(config_text, 1, config_st.st_size, f); if (sz == 0) { @@ -560,10 +556,13 @@ rc = gvconfig_plugin_install_from_config(gvc, config_text); /* NB. config_text not freed because we retain char* into it */ } - } - if (f) { + fclose(f); - } + } + else { + agerr (AGERR,"failed to open %s for read.\n", gvc->config_path); + exit(1); + } } } #endif