commit - a47c234bedbcc16108a0e4f03b6f333ef72729c8
commit + cf758c3329364c1516e2b78c573d6901843bc670
blob - 942a9436ab608ca818a0e6788a6d48774c385bbe
blob + 5acf852dec04af7440d6eb40c4a8f159f7f7a8b4
--- client.c
+++ client.c
static struct evbuffer *evb;
static uint32_t peerid;
-static int handshaked, attached;
+static int handshaked;
uint32_t msize;
static ATTR_DEAD void client_shutdown(void);
close(qid->fd);
free(qid);
-
- if (STAILQ_EMPTY(&qids))
- attached = 0;
}
static struct fid *
uint32_t fid, afid;
int fd;
char aname[PATH_MAX];
-
- if (attached) {
- np_error(hdr->tag, "already attached");
- return;
- }
/* fid[4] afid[4] uname[s] aname[s] */
goto err;
case READSTRTRUNC:
np_error(hdr->tag, "name too long");
+ return;
+ }
+
+ if (fid_by_id(fid) != NULL || afid != NOFID) {
+ np_error(hdr->tag, "invalid fid or afid");
return;
}
if ((qid = qid_from_fd(fd, NULL, NULL)) == NULL)
goto fail;
- log_debug("attached %s", aname);
+ log_debug("attached %s to %d", aname, fid);
if ((f = new_fid(qid, fid)) == NULL) {
qid_decref(qid);
}
np_attach(hdr->tag, qid);
- attached = 1;
return;
fail: