Mercurial > hg > Applications > virsh-wrapper
changeset 2:1a35a6cb23dd
fix commands, include
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Nov 2012 11:51:26 +0900 |
parents | 1a8257a34493 |
children | 203445eb53a8 |
files | Makefile ie-virsh.c |
diffstat | 2 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sun Nov 11 18:16:27 2012 +0900 +++ b/Makefile Mon Nov 12 11:51:26 2012 +0900 @@ -1,4 +1,5 @@ TARGET = ie-virsh +CFLAGS = -Wall -O2 -g $(TARGET): $(TARGET).c $(CC) $(CFLAGS) $(TARGET).c -o $(TARGET)
--- a/ie-virsh.c Sun Nov 11 18:16:27 2012 +0900 +++ b/ie-virsh.c Mon Nov 12 11:51:26 2012 +0900 @@ -7,14 +7,16 @@ #include <sys/types.h> #include <unistd.h> #include <signal.h> -#include <strings.h> +#include <string.h> +#include <sys/types.h> #include <regex.h> /******************************************** - * Wrapper - Secure Yourself * + * Virsh Wrapper - Secure Yourself * * * * 2007 - Mike Golvach - eggi@comcast.net * + * 2012 - Shinji KONO kono@ie.u-rykyu.ac.jp * * * * Usage: COMMAND [start|stop] * * * @@ -22,10 +24,10 @@ /* Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License */ -#define command "/bin/ls" -#define list_command "/bin/ls -l /Users/kono/Desktop" -#define start_command "-l" -#define stop_command "-l" +#define command "/usr/bin/virsh" +#define list_command "/usr/bin/virsh list --all" +#define start_command "start" +#define stop_command "shutdown" #define VMNAME_MAX (512) @@ -92,7 +94,7 @@ seteuid(getuid()); regex_t *pattern = NEW(regex_t); - if (regcomp(pattern, name, REG_NOSPEC) != 0) { + if (regcomp(pattern, name, 0) != 0) { exit(0); }