X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=enscript.git;a=blobdiff_plain;f=src%2Futil.c;h=a3814c1b37bf5456807fab6a4908338a384cb06d;hp=39b8441ce6c3caf4697fba7034a14ce5e6b0bc50;hb=a356d343aa9db52b75432cde927b6f9bad6a7c44;hpb=9510e4315705329e51b27fa2f3f688989b9fb37f diff --git a/src/util.c b/src/util.c index 39b8441..a3814c1 100644 --- a/src/util.c +++ b/src/util.c @@ -30,7 +30,7 @@ #define CFG_FATAL(body) \ do { \ - fprintf (stderr, "%s:%s:%d: ", program, fname, line); \ + fprintf (stderr, "%s:%s:%d: ", program, buffer_ptr(&fname), line); \ fprintf body; \ fprintf (stderr, "\n"); \ fflush (stderr); \ @@ -108,10 +108,13 @@ read_config (char *path, char *file) fp = fopen (buffer_ptr (&fname), "r"); - buffer_uninit (&fname); + /* We wait to uninit the buffer so that CFG_FATAL can use it. */ if (fp == NULL) - return 0; + { + buffer_uninit (&fname); + return 0; + } while (fgets (buf, sizeof (buf), fp)) { @@ -436,6 +439,9 @@ read_config (char *path, char *file) else CFG_FATAL ((stderr, _("illegal option: %s"), token)); } + + fclose (fp); + buffer_uninit (&fname); return 1; }