Skip to content

Commit

Permalink
Handle unexpected EOF in mtfsys.c (issue 72)
Browse files Browse the repository at this point in the history
  • Loading branch information
garlick committed Jul 26, 2011
1 parent 5cf64f8 commit 7519ba3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libnpclient/mtfsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,13 @@ npc_rpc(Npcfsys *fs, Npfcall *tc, Npfcall **rc)
pthread_cond_wait(&r.cond, &r.lock);
xpthread_mutex_unlock(&r.lock);

if (r.rc == NULL) {
np_uerror (EPROTO); /* premature EOF */
return -1;
}

/* N.B. allow for auth returning error with ecode == 0 */
if (r.rc->type == P9_RLERROR || r.ecode) {
if (r.ecode || r.rc->type == P9_RLERROR) {
np_uerror(r.ecode);
free(r.rc);
return -1;
Expand Down

0 comments on commit 7519ba3

Please sign in to comment.