[1/3] remote: Move variable declaration out of loop

Submitted by Radostin Stoyanov on Jan. 30, 2019, 9:04 a.m.

Details

Message ID 20190130090449.7342-1-rstoyanov1@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Radostin Stoyanov Jan. 30, 2019, 9:04 a.m.
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
---
 criu/img-remote.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/img-remote.c b/criu/img-remote.c
index 9f49e92fd..014d3f4c5 100644
--- a/criu/img-remote.c
+++ b/criu/img-remote.c
@@ -808,7 +808,7 @@  void check_pending()
 }
 
 void accept_image_connections() {
-	int ret;
+	int ret, n_events, i;
 
 	epoll_fd = epoll_create(EPOLL_MAX_EVENTS);
 	if (epoll_fd < 0) {
@@ -840,8 +840,6 @@  void accept_image_connections() {
 	}
 
 	while (1) {
-		int n_events, i;
-
 		n_events = epoll_wait(epoll_fd, events, EPOLL_MAX_EVENTS, 250);
 		if (n_events < 0) {
 			pr_perror("Failed to epoll wait");

Comments

Andrei Vagin Feb. 1, 2019, 5:31 p.m.
Can you explain why we need this?

On Wed, Jan 30, 2019 at 09:04:47AM +0000, Radostin Stoyanov wrote:
> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
> ---
>  criu/img-remote.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/criu/img-remote.c b/criu/img-remote.c
> index 9f49e92fd..014d3f4c5 100644
> --- a/criu/img-remote.c
> +++ b/criu/img-remote.c
> @@ -808,7 +808,7 @@ void check_pending()
>  }
>  
>  void accept_image_connections() {
> -	int ret;
> +	int ret, n_events, i;
>  
>  	epoll_fd = epoll_create(EPOLL_MAX_EVENTS);
>  	if (epoll_fd < 0) {
> @@ -840,8 +840,6 @@ void accept_image_connections() {
>  	}
>  
>  	while (1) {
> -		int n_events, i;
> -
>  		n_events = epoll_wait(epoll_fd, events, EPOLL_MAX_EVENTS, 250);
>  		if (n_events < 0) {
>  			pr_perror("Failed to epoll wait");
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
Radostin Stoyanov Feb. 1, 2019, 8:25 p.m.
On 01/02/2019 17:31, Andrei Vagin wrote:
> Can you explain why we need this?
We don't, it's a mistake.

Radostin