char *map_ptr(struct map_struct *map,off_t offset,int len)
{
+ int nread = -2;
+
if (map->map)
return map->map+offset;
}
if (lseek(map->fd,offset,SEEK_SET) != offset ||
- read(map->fd,map->p,len) != len) {
- fprintf(FERROR,"EOF in map_ptr!\n");
+ (nread=read(map->fd,map->p,len)) != len) {
+ fprintf(FERROR,"EOF in map_ptr! (offset=%d len=%d nread=%d errno=%d)\n",
+ (int)offset, len, nread, errno);
exit_cleanup(1);
}
fprintf(FERROR,"Failed to dup/close : %s\n",strerror(errno));
exit_cleanup(1);
}
+ if (to_child_pipe[0] != STDIN_FILENO) close(to_child_pipe[0]);
+ if (from_child_pipe[1] != STDOUT_FILENO) close(from_child_pipe[1]);
execvp(command[0], command);
fprintf(FERROR,"Failed to exec %s : %s\n",
command[0],strerror(errno));