mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virsh: remove trailing whitespace even when editing the description
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@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
2f22d2a1ef
commit
3b31aeaae3
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user