From b1b9e717970f3fcdfbba798b84ed6588db06d654 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 16 Jan 2006 16:32:51 +0000 Subject: [PATCH] Fixed problem with empty bottom text SVN revision: 1603 --- src/elogd.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index 96e35f51..47d211a5 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -7016,28 +7016,30 @@ void show_bottom_text(LOGBOOK * lbs) FILE *f; char file_name[256], *buf; - /* check if file starts with an absolute directory */ - if (str[0] == DIR_SEPARATOR || str[1] == ':') - strcpy(file_name, str); - else { - strlcpy(file_name, resource_dir, sizeof(file_name)); - strlcat(file_name, str, sizeof(file_name)); + if (str[0]) { + /* check if file starts with an absolute directory */ + if (str[0] == DIR_SEPARATOR || str[1] == ':') + strcpy(file_name, str); + else { + strlcpy(file_name, resource_dir, sizeof(file_name)); + strlcat(file_name, str, sizeof(file_name)); + } + + f = fopen(file_name, "rb"); + if (f != NULL) { + fseek(f, 0, SEEK_END); + size = TELL(fileno(f)); + fseek(f, 0, SEEK_SET); + + buf = xmalloc(size + 1); + fread(buf, 1, size, f); + buf[size] = 0; + fclose(f); + + rsputs(buf); + } else + rsputs(str); } - - f = fopen(file_name, "rb"); - if (f != NULL) { - fseek(f, 0, SEEK_END); - size = TELL(fileno(f)); - fseek(f, 0, SEEK_SET); - - buf = xmalloc(size + 1); - fread(buf, 1, size, f); - buf[size] = 0; - fclose(f); - - rsputs(buf); - } else - rsputs(str); } else /* add little logo */ rsprintf