diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2022-01-17 11:39:53 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2022-01-18 10:48:59 +0100 |
commit | b8b3839bba75a96acc852d83b02434d921b0e065 (patch) | |
tree | 08732b81edd372aed2efda2b506f6a1ff9fd98a0 /src/client.c | |
parent | eaf7ed9da0aba4353d6aeda351553aa47fa6d2a5 (diff) |
#915 remove temporary file to store shell output
Remove legacy behaviour, store it in the client object instead of a temporary
file.
Diffstat (limited to 'src/client.c')
-rw-r--r-- | src/client.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/client.c b/src/client.c index ad4c5d3..9796005 100644 --- a/src/client.c +++ b/src/client.c @@ -135,11 +135,9 @@ static int og_resp_probe(struct og_client *cli, json_t *data) static int og_resp_shell_run(struct og_client *cli, json_t *data) { const char *output = NULL; - char filename[4096]; const char *key; json_t *value; int err = -1; - FILE *file; if (json_typeof(data) != JSON_OBJECT) return -1; @@ -158,16 +156,8 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data) return -1; } - sprintf(filename, "/tmp/_Seconsola_%s", inet_ntoa(cli->addr.sin_addr)); - file = fopen(filename, "wt"); - if (!file) { - syslog(LOG_ERR, "cannot open file %s: %s\n", - filename, strerror(errno)); - return -1; - } - - fprintf(file, "%s", output); - fclose(file); + free((void *)cli->shell_output); + cli->shell_output = strdup(output); return 0; } |