mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +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;
|
return false;
|
||||||
|
|
||||||
/* strip a possible newline at the end of file; some
|
/* 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 */
|
* more convenient */
|
||||||
if (title &&
|
if ((tmpstr = strrchr(desc_edited, '\n')) &&
|
||||||
(tmpstr = strrchr(desc_edited, '\n')) &&
|
|
||||||
*(tmpstr+1) == '\0')
|
*(tmpstr+1) == '\0')
|
||||||
*tmpstr = '\0';
|
*tmpstr = '\0';
|
||||||
|
|
||||||
|
@ -481,8 +481,7 @@ cmdNetworkDesc(vshControl *ctl, const vshCmd *cmd)
|
|||||||
/* strip a possible newline at the end of file; some
|
/* 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 the title
|
||||||
* more convenient */
|
* more convenient */
|
||||||
if (title &&
|
if ((tmpstr = strrchr(desc_edited, '\n')) &&
|
||||||
(tmpstr = strrchr(desc_edited, '\n')) &&
|
|
||||||
*(tmpstr+1) == '\0')
|
*(tmpstr+1) == '\0')
|
||||||
*tmpstr = '\0';
|
*tmpstr = '\0';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user