diff options
author | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2019-05-29 17:58:37 +0900 |
---|---|---|
committer | Saya Sugiura <ssugiura@jp.adit-jv.com> | 2019-06-19 11:00:37 +0900 |
commit | 9cf8c10a22542ce784c383d7e371797c4b9910ac (patch) | |
tree | b43fb9e5692e8354dc203fc382c3263d7876ad40 /src/console/dlt-receive.c | |
parent | 6088448cdfe3cd152c53136544acc4ee7a508a84 (diff) | |
download | DLT-daemon-9cf8c10a22542ce784c383d7e371797c4b9910ac.tar.gz |
cleanup: Use dlt_vlog()
There were a couple of places which used snprintf-dlt_log. It is
now replaced with dlt_vlog().
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
Diffstat (limited to 'src/console/dlt-receive.c')
-rw-r--r-- | src/console/dlt-receive.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c index 9cfad36..aef92b9 100644 --- a/src/console/dlt-receive.c +++ b/src/console/dlt-receive.c @@ -188,13 +188,10 @@ int64_t convert_arg_to_byte_size(char *arg) min_size += 2048 /* DLT_USER_BUF_MAX_SIZE */; if (min_size > result) { - char tmp[256]; - snprintf(tmp, - 256, + dlt_vlog(LOG_ERR, "ERROR: Specified limit: %" PRId64 "is smaller than a the size of a single message: %" PRId64 "!\n", result, min_size); - dlt_log(LOG_ERR, tmp); result = -2; } @@ -212,9 +209,7 @@ int dlt_receive_open_output_file(DltReceiveData *dltdata) if (glob(dltdata->ovalue, GLOB_TILDE | GLOB_NOSORT, NULL, &outer) == 0) { if (dltdata->vflag) { - char tmp[256]; - snprintf(tmp, 256, "File %s already exists, need to rename first\n", dltdata->ovalue); - dlt_log(LOG_INFO, tmp); + dlt_vlog(LOG_INFO, "File %s already exists, need to rename first\n", dltdata->ovalue); } if (dltdata->part_num < 0) { @@ -257,15 +252,12 @@ int dlt_receive_open_output_file(DltReceiveData *dltdata) snprintf(filename, PATH_MAX, "%s.%i.dlt", dltdata->ovaluebase, dltdata->part_num++); if (rename(dltdata->ovalue, filename) != 0) { - char tmp[256]; - snprintf(tmp, 256, "ERROR: rename %s to %s failed with error %s\n", dltdata->ovalue, filename, - strerror(errno)); - dlt_log(LOG_ERR, tmp); + dlt_vlog(LOG_ERR, "ERROR: rename %s to %s failed with error %s\n", + dltdata->ovalue, filename, strerror(errno)); } else if (dltdata->vflag) { - char tmp[256]; - snprintf(tmp, 256, "Renaming existing file from %s to %s\n", dltdata->ovalue, filename); - dlt_log(LOG_INFO, tmp); + dlt_vlog(LOG_INFO, "Renaming existing file from %s to %s\n", + dltdata->ovalue, filename); } } /* if (file_already_exists) */ @@ -483,9 +475,8 @@ int main(int argc, char *argv[]) /* open DLT output file */ if (dltdata.ovalue) { if (dltdata.climit > -1) { - char tmp[256]; - snprintf(tmp, 256, "Using file size limit of %" PRId64 "bytes\n", dltdata.climit); - dlt_log(LOG_INFO, tmp); + dlt_vlog(LOG_INFO, "Using file size limit of %" PRId64 "bytes\n", + dltdata.climit); dltdata.ohandle = dlt_receive_open_output_file(&dltdata); } else { /* in case no limit for the output file is given, we simply overwrite any existing file */ |