This just ensures that we accurately report errors, even if our
error path code doesn't set errno. We won't end up with a bogus
errno left over from a previous call.
#include <rpc/types.h>
#include <rpc/xdr.h>
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
#include "c-ctype.h"
#include "ignore-value.h"
goto cont;
}
- /* Now start to process this message. */
proc_nr = hdr.proc;
serial = hdr.serial;
+
+ /* Clear errors before we call the stub functions. This is just
+ * to ensure that we can accurately report errors in cases where
+ * error handling paths don't set errno correctly.
+ */
+ errno = 0;
+#ifdef WIN32
+ SetLastError (0);
+ WSASetLastError (0);
+#endif
+
+ /* Now start to process this message. */
dispatch_incoming_message (&xdr);
/* Note that dispatch_incoming_message will also send a reply. */