--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="android" name="Android">
+ <configuration />
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="Android 4.2.2" jdkType="Android SDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="Widgets" />
+ </component>
+</module>
+
static char* read_string(int fd) {
int len = read_int(fd);
+ if (len > PATH_MAX) {
+ LOGE("string too long");
+ exit(-1);
+ }
char* val = malloc(sizeof(char) * (len + 1));
val[len] = '\0';
int amount = read(fd, val, len);
int i;
for (i = 0; i < argc; i++) {
argv[i] = read_string(fd);
- LOGD("arg: %s", argv[i]);
}
- LOGD("args done");
char errfile[PATH_MAX];
char outfile[PATH_MAX];
int ptm = -1;
char* devname = NULL;
if (atty) {
- LOGD("opening ptm");
ptm = open("/dev/ptmx", O_RDWR);
if (ptm <= 0) {
PLOGE("ptm");
close(fd);
if (devname != NULL) {
- LOGD("opening pts");
int pts = open(devname, O_RDWR);
if(pts < 0) {
PLOGE("pts");
}
if (devname != NULL) {
- LOGD("pumping ptm");
// pump ptm across the socket
pump_async(infd, ptm);
pump(ptm, outfd);
exit(-1);
}
- LOGD("client is: %d", getpid());
+ LOGD("connecting client %d", getpid());
write_int(socketfd, getpid());
write_int(socketfd, isatty(STDIN_FILENO));
write_int(socketfd, uid);
write_int(socketfd, getppid());
write_int(socketfd, argc);
- LOGD("about to write args");
int i;
for (i = 0; i < argc; i++) {
- LOGD("writing arg");
write_string(socketfd, argv[i]);
}
- LOGD("waiting for server ack");
// ack
read_int(socketfd);
pump(outfd, STDOUT_FILENO);
int code = read_int(socketfd);
- LOGD("daemon client done %d", code);
+ LOGD("client exited %d", code);
return code;
}