libubus: mark ubus socket with close-on-exec
[project/ubus.git] / libubus-io.c
index 31dad27..3280e41 100644 (file)
@@ -379,7 +379,7 @@ int ubus_reconnect(struct ubus_context *ctx, const char *path)
                goto out_free;
 
        ret = UBUS_STATUS_OK;
                goto out_free;
 
        ret = UBUS_STATUS_OK;
-       fcntl(ctx->sock.fd, F_SETFL, fcntl(ctx->sock.fd, F_GETFL) | O_NONBLOCK);
+       fcntl(ctx->sock.fd, F_SETFL, fcntl(ctx->sock.fd, F_GETFL) | O_NONBLOCK | O_CLOEXEC);
 
        ubus_refresh_state(ctx);
 
 
        ubus_refresh_state(ctx);