win32 more build fixes
[platform/upstream/libwebsockets.git] / lib / context.c
index 8c0a69b..b3f7c4c 100644 (file)
@@ -373,11 +373,13 @@ lws_create_vhost(struct lws_context *context,
                                 info->log_filepath);
                        goto bail;
                }
+#ifndef WIN32
                if (context->uid != -1)
                        if (chown(info->log_filepath, context->uid,
                                  context->gid) == -1)
                                lwsl_err("unable to chown log file %s\n",
                                                info->log_filepath);
+#endif
        } else
                vh->log_fd = LWS_INVALID_FILE;
 #endif
@@ -703,7 +705,7 @@ lws_context_destroy(struct lws_context *context)
 {
        const struct lws_protocols *protocol = NULL;
        struct lws_context_per_thread *pt;
-       struct lws_vhost *vh, *vh1;
+       struct lws_vhost *vh = NULL, *vh1;
        struct lws wsi;
        int n, m;
 
@@ -736,6 +738,7 @@ lws_context_destroy(struct lws_context *context)
                                /* no protocol close */);
                        n--;
                }
+               lws_pt_mutex_destroy(pt);
        }
        /*
         * give all extensions a chance to clean up any per-context
@@ -754,7 +757,8 @@ lws_context_destroy(struct lws_context *context)
         *
         * We can't free things until after the event loop shuts down.
         */
-       vh = context->vhost_list;
+       if (context->protocol_init_done)
+               vh = context->vhost_list;
        while (vh) {
                wsi.vhost = vh;
                protocol = vh->protocols;