]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - command.c
build: Fix --with-opus-libs.
[paraslash.git] / command.c
index ec822c82978d78649b6641d2206f41db44ab3bd7..41a58eac0517e15e44c964250578173708289e60 100644 (file)
--- a/command.c
+++ b/command.c
@@ -395,7 +395,8 @@ static int com_si(struct command_context *cc)
                free(info);
        }
        ut = get_server_uptime_str(now);
-       ret = xasprintf(&msg, "version: " GIT_VERSION "\n"
+       ret = xasprintf(&msg,
+               "version: %s\n"
                "up: %s\nplayed: %u\n"
                "server_pid: %d\n"
                "afs_pid: %d\n"
@@ -403,6 +404,7 @@ static int com_si(struct command_context *cc)
                "current loglevel: %s\n"
                "supported audio formats: %s\n"
                "%s",
+               version_git(),
                ut, mmd->num_played,
                (int)getppid(),
                (int)mmd->afs_pid,
@@ -431,11 +433,9 @@ static int com_version(struct command_context *cc)
 
        if (cc->argc != 1)
                return -E_COMMAND_SYNTAX;
-       msg = VERSION_TEXT("server") "built: " BUILD_DATE "\n" UNAME_RS
-               ", " CC_VERSION "\n";
-       len = strlen(msg);
+       len = xasprintf(&msg, "%s", version_text("server"));
        if (cc->use_sideband)
-               return send_sb(&cc->scc, msg, len, SBD_OUTPUT, true);
+               return send_sb(&cc->scc, msg, len, SBD_OUTPUT, false);
        return sc_send_bin_buffer(&cc->scc, msg, len);
 }
 
@@ -474,11 +474,8 @@ static int com_version(struct command_context *cc)
  */
 static unsigned empty_status_items(int parser_friendly, char **result)
 {
-       static char *esi;
-       static unsigned len;
-
-       if (esi)
-               goto out;
+       char *esi;
+       unsigned len;
 
        if (parser_friendly)
                len = xasprintf(&esi,
@@ -498,7 +495,6 @@ static unsigned empty_status_items(int parser_friendly, char **result)
                        EMPTY_STATUS_ITEMS
                        #undef ITEM
                );
-out:
        *result = esi;
        return len;
 }
@@ -509,7 +505,7 @@ static int com_stat(struct command_context *cc)
 {
        int i, ret;
        struct misc_meta_data tmp, *nmmd = &tmp;
-       char *s, *esi = NULL;
+       char *s;
        int32_t num = 0;
        int parser_friendly = 0;
 
@@ -549,12 +545,15 @@ static int com_stat(struct command_context *cc)
                if (ret < 0)
                        goto out;
                if (nmmd->vss_status_flags & VSS_NEXT) {
+                       char *esi;
                        ret = empty_status_items(parser_friendly, &esi);
                        if (cc->use_sideband)
                                ret = send_sb(&cc->scc, esi, ret, SBD_OUTPUT,
-                                       true);
-                       else
+                                       false);
+                       else {
                                ret = sc_send_bin_buffer(&cc->scc, esi, ret);
+                               free(esi);
+                       }
                        if (ret < 0)
                                goto out;
                } else
@@ -568,7 +567,6 @@ static int com_stat(struct command_context *cc)
                        goto out;
        }
 out:
-       free(esi);
        return ret;
 }