From: Jim Meyering Date: Sun, 5 Mar 2000 10:27:22 +0000 (+0000) Subject: ("path-concat.h"): Include. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f36ae9ded052371bd995708ab1f587db5c0f3bc;p=pspp ("path-concat.h"): Include. (get_charset_aliases): Use path_concat instead of ANSI string concatenation. --- diff --git a/lib/localcharset.c b/lib/localcharset.c index 461320823d..86f7ed1b2e 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -45,6 +45,8 @@ # endif #endif +#include "path-concat.h" + char *xmalloc (); char *xrealloc (); @@ -69,10 +71,10 @@ get_charset_aliases () if (cp == NULL) { FILE *fp; + char *file_name = path_concat (LIBDIR, "charset.alias", NULL); - fp = fopen (LIBDIR "/" "charset.alias", "r"); - if (fp == NULL) - /* File not found, treat it as empty. */ + if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL) + /* Out of memory or file not found, treat it as empty. */ cp = ""; else { @@ -130,6 +132,7 @@ get_charset_aliases () } charset_aliases = cp; + free (file_name); } return cp;