summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-03-05 10:27:22 +0000
committerJim Meyering <jim@meyering.net>2000-03-05 10:27:22 +0000
commitb7d59be6a4c2acfd2ca32b64cf5456ed505e1f4a (patch)
treee08f6d0ea492b43dbc7a1b8238a59a8731ee052d
parent7206cd3b013c894a4cd7ecf1440b898eaf05fa18 (diff)
downloadcoreutils-b7d59be6a4c2acfd2ca32b64cf5456ed505e1f4a.tar.xz
("path-concat.h"): Include.
(get_charset_aliases): Use path_concat instead of ANSI string concatenation.
-rw-r--r--lib/localcharset.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 461320823..86f7ed1b2 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;