- if( fread(buf, 512, 1, pipe) == 0 ) return -1; // Flush!
+
+ // Child process
+ if( childPid == 0 )
+ {
+ execl("/usr/bin/llogin", "llogin", "door", "-w-", NULL);
+ perror("execl");
+ exit(-1);
+ }
+
+ child_stdin = fdopen(child_stdin_fd, "w");
+
+ int read_child_output()
+ {
+ char buf[1024];
+ int len;
+ if( giDoor_ChildStatus || (len = read(child_stdin_fd, buf, sizeof buf)) < 0)
+ {
+ #if DEBUG
+ printf("Door_DoDispense: fread fail\n");
+ #endif
+ return -1;
+ }
+ buf[len] = '\0';
+
+ #if DEBUG > 1
+ printf("Door_DoDispense: buf = %i '%s'\n", len, buf);
+ #endif
+ return 0;
+ }
+
+ if( read_child_output() ) return -1;