From: Michal Rakowski Date: Mon, 7 Jun 2021 06:00:40 +0000 (+0200) Subject: Fix #7770 About the full restore client name displayed in the restore job status X-Git-Tag: Release-11.3.2~503 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7707521748c1e894d962d0a378b99cba39748ced;p=thirdparty%2Fbacula.git Fix #7770 About the full restore client name displayed in the restore job status --- diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index ddaba6ba7..cddf5b427 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -642,6 +642,7 @@ bool do_restore_init(JCR *jcr) void restore_cleanup(JCR *jcr, int TermCode) { POOL_MEM where; + CLIENT_DBR cr; char creplace; const char *replace = NULL; char sdt[MAX_TIME_LENGTH], edt[MAX_TIME_LENGTH]; @@ -655,6 +656,13 @@ void restore_cleanup(JCR *jcr, int TermCode) Dmsg0(20, "In restore_cleanup\n"); update_job_end(jcr, TermCode); + memset(&cr, 0, sizeof(cr)); + bstrncpy(cr.Name, jcr->client->name(), sizeof(cr.Name)); + if (!db_get_client_record(jcr, jcr->db, &cr)) { + Jmsg(jcr, M_WARNING, 0, _("Error getting Client record for Job report: ERR=%s"), + db_strerror(jcr->db)); + } + if (jcr->component_fd) { fclose(jcr->component_fd); jcr->component_fd = NULL; @@ -733,7 +741,7 @@ void restore_cleanup(JCR *jcr, int TermCode) " Build OS: %s %s %s\n" " JobId: %d\n" " Job: %s\n" -" Restore Client: %s\n" +" Restore Client: \"%s\" %s\n" " Where: %s\n" " Replace: %s\n" " Start time: %s\n" @@ -751,7 +759,7 @@ void restore_cleanup(JCR *jcr, int TermCode) HOST_OS, DISTNAME, DISTVER, jcr->jr.JobId, jcr->jr.Job, - jcr->client->name(), + jcr->client->name(), cr.Uname, where.c_str(), replace, sdt,