exportfs: avoid closing netfd in filter()

netfd is initially zero (stdin), when filter() closes fd0,
fd0 is free to be reused. this causes problems with openmount()
that assumes sfd being >2.

instead, we dup the our pipe end over netfd, and close the pipe.
This commit is contained in:
cinap_lenrek 2014-03-11 07:03:15 +01:00
parent 2c0490a26e
commit eed4871674

View file

@ -927,10 +927,11 @@ filter(int fd, char *cmd)
exec(file, argv);
fatal("filter: exec; %r");
default:
close(fd);
dup(p[1], fd);
close(p[0]);
close(p[1]);
}
return p[1];
return fd;
}
static void