When editing the title of a domain or network via the `desc` or
`net-desc` commands, we strip the final newline that is added by some
editors.
Do the same when editing the description as well.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tools/virsh-domain.c | 5 ++---
tools/virsh-network.c | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e69d14a6aa..7a87da1cbb 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8525,10 +8525,9 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
return false;
/* strip a possible newline at the end of file; some
- * editors enforce a newline, this makes editing the title
+ * editors enforce a newline, this makes editing
* more convenient */
- if (title &&
- (tmpstr = strrchr(desc_edited, '\n')) &&
+ if ((tmpstr = strrchr(desc_edited, '\n')) &&
*(tmpstr+1) == '\0')
*tmpstr = '\0';
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 68c7543863..c676fc603c 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -481,8 +481,7 @@ cmdNetworkDesc(vshControl *ctl, const vshCmd *cmd)
/* strip a possible newline at the end of file; some
* editors enforce a newline, this makes editing the title
* more convenient */
- if (title &&
- (tmpstr = strrchr(desc_edited, '\n')) &&
+ if ((tmpstr = strrchr(desc_edited, '\n')) &&
*(tmpstr+1) == '\0')
*tmpstr = '\0';
--
2.43.2