win32 add build script for visual studio
[deb_libnfs.git] / lib / libnfs.c
index 5fd91ea03e6379ea55e246ef2396976bb1f8444a..df8ae802cf6149537c73ced356bff11e8406fa5b 100644 (file)
@@ -2899,11 +2899,12 @@ void nfs_set_error(struct nfs_context *nfs, char *error_string, ...)
        char *str = NULL;
 
         va_start(ap, error_string);
-       //      vasprintf(&str, error_string, ap);
-       //      if (nfs->rpc->error_string != NULL) {
-       //      free(nfs->rpc->error_string);
-       //}
-       //nfs->rpc->error_string = str;
+       str = malloc(1024);
+       vsnprintf(str, 1024, error_string, ap);
+       if (nfs->rpc->error_string != NULL) {
+               free(nfs->rpc->error_string);
+       }
+       nfs->rpc->error_string = str;
         va_end(ap);
 }
 
@@ -3081,3 +3082,35 @@ const char *nfs_get_server(struct nfs_context *nfs) {
 const char *nfs_get_export(struct nfs_context *nfs) {
        return nfs->export;
 }
+
+
+#if defined(WIN32)
+int poll(struct pollfd *fds, int nfsd, int timeout)
+{
+       fd_set rfds, wfds, efds;
+       int ret;
+
+       FD_ZERO(&rfds);
+       FD_ZERO(&wfds);
+       FD_ZERO(&efds);
+       if (fds->events & POLLIN) {
+               FD_SET(fds->fd, &rfds);
+       }
+       if (fds->events & POLLOUT) {
+               FD_SET(fds->fd, &wfds);
+       }
+       FD_SET(fds->fd, &efds);
+       select(fds->fd + 1, &rfds, &wfds, &efds, NULL);
+       fds->revents = 0;
+       if (FD_ISSET(fds->fd, &rfds)) {
+               fds->revents |= POLLIN;
+       }
+       if (FD_ISSET(fds->fd, &wfds)) {
+               fds->revents |= POLLOUT;
+       }
+       if (FD_ISSET(fds->fd, &efds)) {
+               fds->revents |= POLLHUP;
+       }
+}
+#endif
+