diff --git a/src/elogd.c b/src/elogd.c
index c72a4777..0b28ee30 100755
--- a/src/elogd.c
+++ b/src/elogd.c
@@ -38,7 +38,7 @@
#include "elogd.h"
#include "git-revision.h"
-const char *git_revision = GIT_REVISION;
+const char *_git_revision = GIT_REVISION;
BOOL running_as_daemon; /* Running as a daemon/service? */
int elog_tcp_port; /* Server's TCP port */
@@ -7182,11 +7182,21 @@ void set_cookie(LOGBOOK * lbs, char *name, char *value, BOOL global, char *expir
/*------------------------------------------------------------------*/
+const char *git_revision()
+{
+ const char *p = _git_revision;
+ if (strchr(p, '-'))
+ p = strchr(p, '-')+2;
+ return p;
+}
+
+/*------------------------------------------------------------------*/
+
void redirect(LOGBOOK * lbs, char *rel_path)
{
/* redirect */
rsprintf("HTTP/1.1 302 Found\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
if (keep_alive) {
rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@@ -7422,7 +7432,7 @@ void show_http_header(LOGBOOK * lbs, BOOL expires, char *cookie)
char str[256];
rsprintf("HTTP/1.1 200 Document follows\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
if (getcfg("global", "charset", str, sizeof(str)))
rsprintf("Content-Type: text/html;charset=%s\r\n", str);
@@ -7449,7 +7459,7 @@ void show_plain_header(int size, char *file_name)
{
/* header */
rsprintf("HTTP/1.1 200 Document follows\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
rsprintf("Accept-Ranges: bytes\r\n");
if (keep_alive) {
@@ -8125,7 +8135,7 @@ void show_bottom_text(LOGBOOK * lbs)
/* add little logo */
rsprintf
("
ELOG V%s-%s",
- loc("Goto ELOG home page"), VERSION, git_revision + 33);
+ loc("Goto ELOG home page"), VERSION, git_revision());
}
/*------------------------------------------------------------------*/
@@ -8179,7 +8189,7 @@ void show_bottom_text_login(LOGBOOK * lbs)
/* add little logo */
rsprintf
("ELOG V%s-%s",
- loc("Goto ELOG home page"), VERSION, git_revision + 33);
+ loc("Goto ELOG home page"), VERSION, git_revision());
}
/*------------------------------------------------------------------*/
@@ -8190,7 +8200,7 @@ void show_error(char *error)
/* header */
rsprintf("HTTP/1.1 404 Not Found\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
if (getcfg("global", "charset", str, sizeof(str)))
rsprintf("Content-Type: text/html;charset=%s\r\n", str);
else
@@ -8258,7 +8268,7 @@ void set_sid_cookie(LOGBOOK * lbs, char *sid, char *full_name)
BOOL global;
rsprintf("HTTP/1.1 302 Found\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
if (keep_alive) {
rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@@ -8302,7 +8312,7 @@ void remove_all_login_cookies(LOGBOOK * lbs)
int i;
rsprintf("HTTP/1.1 302 Found\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
if (keep_alive) {
rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@@ -8346,7 +8356,7 @@ void send_file_direct(char *file_name)
lseek(fh, 0, SEEK_SET);
rsprintf("HTTP/1.1 200 Document follows\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
rsprintf("Accept-Ranges: bytes\r\n");
/* set expiration time to one day if no thumbnail */
@@ -8684,7 +8694,7 @@ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_
strcpy(value[i++], VERSION);
strcpy(list[i], "revision");
- sprintf(value[i++], "%s", git_revision + 33);
+ sprintf(value[i++], "%s", git_revision());
return i;
}
@@ -15198,7 +15208,7 @@ int show_md5_page(LOGBOOK * lbs)
/* header */
rsprintf("HTTP/1.1 200 Document follows\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
rsprintf("Accept-Ranges: bytes\r\n");
rsprintf("Connection: close\r\n");
rsprintf("Content-Type: text/plain;charset=%s\r\n", DEFAULT_HTTP_CHARSET);
@@ -19310,7 +19320,7 @@ void show_rss_feed(LOGBOOK * lbs)
struct tm *ts;
rsprintf("HTTP/1.1 200 Document follows\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
if (!getcfg("global", "charset", charset, sizeof(charset)))
strcpy(charset, DEFAULT_HTTP_CHARSET);
@@ -26585,7 +26595,7 @@ void show_uploader_json(LOGBOOK *lbs)
const long MAX_FILE_COUNT = 100;
rsprintf("HTTP/1.1 200 Document follows\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
rsprintf("Accept-Ranges: bytes\r\n");
rsprintf("Pragma: no-cache\r\n");
rsprintf("Cache-control: private, max-age=0, no-cache, no-store\r\n");
@@ -29072,7 +29082,7 @@ void server_loop(void)
/* about to entering the server loop, welcome user with a brief info */
eprintf("%s ", ELOGID);
- strcpy(str, git_revision + 33);
+ strcpy(str, git_revision());
if (strchr(str, ' '))
*strchr(str, ' ') = 0;
eprintf("revision %s\n", str);
@@ -29556,7 +29566,7 @@ void server_loop(void)
} else if (strstr(net_buffer, "HEAD") != NULL) {
/* just return header */
rsprintf("HTTP/1.1 200 OK\r\n");
- rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision + 33);
+ rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision());
rsprintf("Connection: close\r\n");
rsprintf("Content-Type: text/html\r\n\r\n");
keep_alive = FALSE;