pid = getpid();
- for(;;){
- /*
- * reading from a pipe or a network device
- * will give an error after a few eof reads.
- * however, we cannot tell the difference
- * between a zero-length read and an interrupt
- * on the processes writing to us,
- * so we wait for the error.
- */
- n = read9pmsg(mfd[0], mdata, messagesize);
+ while((n = read9pmsg(mfd[0], mdata, messagesize)) != 0){
if(n < 0)
- sysfatal("mount read");
- if(n == 0)
- continue;
- if(convM2S(mdata, n, &thdr) == 0)
- continue;
+ sysfatal("mount read: %r");
+ if(convM2S(mdata, n, &thdr) != n)
+ sysfatal("convM2S format error: %r");
if(debug)
fprint(2, "%s %d:<-%F\n", argv0, pid, &thdr);