rv = (dispatcher->func)(server, client, msg, &rerr, arg, ret);
/*
- * Clear out the FDs we got from the client, we don't
- * want to send them back !
+ * If rv == 1, this indicates the dispatch func has
+ * populated 'msg' with a list of FDs to return to
+ * the caller.
+ *
+ * Otherwise we must clear out the FDs we got from
+ * the client originally.
*
- * XXX we don't have a way to let dispatcher->func
- * return any FDs. Fortunately we don't need this
- * capability just yet
*/
- for (i = 0 ; i < msg->nfds ; i++)
- VIR_FORCE_CLOSE(msg->fds[i]);
- VIR_FREE(msg->fds);
- msg->nfds = 0;
+ if (rv != 1) {
+ for (i = 0 ; i < msg->nfds ; i++)
+ VIR_FORCE_CLOSE(msg->fds[i]);
+ VIR_FREE(msg->fds);
+ msg->nfds = 0;
+ }
xdr_free(dispatcher->arg_filter, arg);