aboutsummaryrefslogtreecommitdiff
path: root/util/log.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-17 11:29:43 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-20 10:51:11 -0700
commite2c7c6a454c2c4221461aa04e4061dbb91b4986c (patch)
treee60843c94e954127b0a92a41099c97a840750fa4 /util/log.c
parenteecb0c4e1125c751ded392456b43a036e8efe1ab (diff)
downloadqemu-e2c7c6a454c2c4221461aa04e4061dbb91b4986c.zip
qemu-e2c7c6a454c2c4221461aa04e4061dbb91b4986c.tar.gz
qemu-e2c7c6a454c2c4221461aa04e4061dbb91b4986c.tar.bz2
util/log: Return bool from qemu_set_log_filename
Per the recommendations in qapi/error.h, return false on failure. Use the return value in the monitor, the only place we aren't already passing error_fatal or error_abort. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220417183019.755276-4-richard.henderson@linaro.org>
Diffstat (limited to 'util/log.c')
-rw-r--r--util/log.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/log.c b/util/log.c
index ffa66a2..a838686 100644
--- a/util/log.c
+++ b/util/log.c
@@ -138,7 +138,7 @@ void qemu_set_log(int log_flags)
*
* filename may be NULL. In that case, log output is sent to stderr
*/
-void qemu_set_log_filename(const char *filename, Error **errp)
+bool qemu_set_log_filename(const char *filename, Error **errp)
{
g_free(logfilename);
logfilename = NULL;
@@ -149,7 +149,7 @@ void qemu_set_log_filename(const char *filename, Error **errp)
/* We only accept one %d, no other format strings */
if (pidstr[1] != 'd' || strchr(pidstr + 2, '%')) {
error_setg(errp, "Bad logfile format: %s", filename);
- return;
+ return false;
} else {
logfilename = g_strdup_printf(filename, getpid());
}
@@ -160,6 +160,7 @@ void qemu_set_log_filename(const char *filename, Error **errp)
qemu_log_close();
qemu_set_log(qemu_loglevel);
+ return true;
}
/* Returns true if addr is in our debug filter or no filter defined