[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/9] xl: Improve return and exit codes of migrate related functions.



On Wed, 2016-02-24 at 18:23 +0530, Harmandeep Kaur wrote:
> @@ -50,7 +50,7 @@
>          else if (chk_errnoval > 0)
> {                                    \
>              fprintf(stderr,"xl: fatal error: %s:%d: %s:
> %s\n",          \
>                      __FILE__,__LINE__, strerror(chk_errnoval),
> #call);  \
> -            exit(-
> ERROR_FAIL);                                          \
> +            exit(EXIT_FAILURE);                                     
>     \
>          }                                                           
>     \
>      })
>  
Right below this, there are two more macros, CHK_SYSCALL and MUST,
which also need "fixing"

> @@ -4152,7 +4152,7 @@ static pid_t create_migration_child(const char
> *rune, int *send_fd,
>      pid_t child;
>  
>      if (!rune || !send_fd || !recv_fd)
> -        return -1;
> +        return EXIT_FAILURE;
> 
Err.. no, create_migration_child() is an internal function, so it is ok
for it to return -1/0, isn't it?
>  
>      MUST( libxl_pipe(ctx, sendpipe) );
>      MUST( libxl_pipe(ctx, recvpipe) );
> @@ -4166,7 +4166,7 @@ static pid_t create_migration_child(const char
> *rune, int *send_fd,
>          close(recvpipe[0]); close(recvpipe[1]);
>          execlp("sh","sh","-c",rune,(char*)0);
>          perror("failed to exec sh");
> -        exit(-1);
> +        exit(EXIT_FAILURE);
>      }
Of course, in this specific case, since it's an exit() and not a
'return', it is ok to convert this to EXIT_FAILURE, like you're doing.

> @@ -4189,16 +4189,16 @@ static int migrate_read_fixedmessage(int fd,
> const void *msg, int msgsz,
>  
>      stream = rune ? "migration receiver stream" : "migration
> stream";
>      rc = libxl_read_exactly(ctx, fd, buf, msgsz, stream, what);
> -    if (rc) return ERROR_FAIL;
> +    if (rc) return EXIT_FAILURE;
>  
Internal too, so ok changing it, but to -1/0.

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.