[PATCH] virsh: send-process-signal: add support for '-NUM' style of signal nums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>

As kill(1), add support for sending signal
in form of "9" as well as "-9".

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
---
 tools/virsh-domain.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7194153..b96b8fd 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8254,9 +8254,14 @@ static int getSignalNumber(vshControl *ctl, const char *signame)
     for (i = 0; signame[i]; i++)
         lower[i] = c_tolower(signame[i]);
 
+    if (STRPREFIX(lower, "-"))
+        lower += 1;
+
     if (virStrToLong_i(lower, NULL, 10, &signum) >= 0)
         goto cleanup;
 
+    lower = tmp;
+
     if (STRPREFIX(lower, "sig_"))
         lower += 4;
     else if (STRPREFIX(lower, "sig"))
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]