Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error handling in MsgLoadCatalog #677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions open-vm-tools/libvmtools/i18n.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ MsgLoadCatalog(const char *path)
gboolean eof = FALSE;
char *name = NULL;
char *value = NULL;
gchar *line;
gchar *line = NULL;

/* Read the next key / value pair. */
for (;;) {
Expand All @@ -493,12 +493,13 @@ MsgLoadCatalog(const char *path)
gsize term;
char *unused = NULL;
gboolean cont = FALSE;
GIOStatus status;

g_io_channel_read_line(stream, &line, &len, &term, &err);
status = g_io_channel_read_line(stream, &line, &len, &term, &err);

if (err != NULL) {
if (status == G_IO_STATUS_ERROR || err != NULL) {
g_warning("Unable to read a line from '%s': %s\n",
path, err->message);
path, err ? err->message : "G_IO_STATUS_ERROR");
g_clear_error(&err);
error = TRUE;
g_free(line);
Expand Down