From: VMware, Inc <> Date: Sat, 28 May 2011 19:51:06 +0000 (-0700) Subject: Fix reading catalogs with Windows line breaks. X-Git-Tag: 2011.05.27-420096~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be89e54575e7cb92fb45908c0ac8661a80b9c564;p=thirdparty%2Fopen-vm-tools.git Fix reading catalogs with Windows line breaks. lib/dict doesn't seem to like Windows line breaks, so fix the line breaks to make it happy. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/libvmtools/i18n.c b/open-vm-tools/libvmtools/i18n.c index 7c7a5d4db..e291cfc80 100644 --- a/open-vm-tools/libvmtools/i18n.c +++ b/open-vm-tools/libvmtools/i18n.c @@ -565,6 +565,17 @@ MsgLoadCatalog(const char *path) break; } + /* + * Fix the line break to always be Unix-style, to make lib/dict + * happy. + */ + if (line[term] == '\r') { + line[term] = '\n'; + if (len > term) { + line[term + 1] = '\0'; + } + } + /* * If currently name is not NULL, then check if this is a continuation * line and, if it is, just append the contents to the current value.