Browse Source

fixed EAFNOSUPPORT error in udp

Mihai Plasoianu 10 years ago
parent
commit
fedb236fa9
2 changed files with 2 additions and 2 deletions
  1. 1 1
      native/bind.c
  2. 1 1
      src/de/tudarmstadt/informatik/hostage/system/Device.java

+ 1 - 1
native/bind.c

@@ -42,7 +42,7 @@ int net_sock(int type, int port) {
 	int reuseaddr = 1;
 	struct sockaddr_in addr;
 
-	if ((fd = socket(AF_INET, (type == 1 ? SOCK_STREAM : SOCK_DGRAM), 0)) == -1) {
+	if ((fd = socket(AF_INET, (type == 1 ? SOCK_STREAM : SOCK_DGRAM), (type == 1 ? IPPROTO_IP : IPPROTO_UDP))) == -1) {
 		perror("Unable to create net socket");
 		return -1;
 	}

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/system/Device.java

@@ -19,7 +19,7 @@ public class Device {
 			@Override
 			public void run() {
 				try {
-					String test = "[ -e /data/local/pp ]";
+					String test = "[ -e /data/local/bind ]";
 					Process su = new ProcessBuilder("su", "-c", test).start();
 					switch (su.waitFor()) {
 					case 0: