[PATCH] xenstored: fix build on libc without O_CLOEXEC

Jan Beulich posted 1 patch 3 years, 2 months ago
Test gitlab-ci passed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/a5af8c21-f12d-d9a0-1751-90e5e8e0902e@suse.com
[PATCH] xenstored: fix build on libc without O_CLOEXEC
Posted by Jan Beulich 3 years, 2 months ago
The call to lu_read_state() would remain unresolved in this case. Frame
the construct by a suitable #ifdef, and while at it also frame command
line handling related pieces similarly.

Fixes: 9777fa6b6ea0 ("tools/xenstore: evaluate the live update flag when starting")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2061,7 +2061,9 @@ static struct option options[] = {
 	{ "internal-db", 0, NULL, 'I' },
 	{ "verbose", 0, NULL, 'V' },
 	{ "watch-nb", 1, NULL, 'W' },
+#ifndef NO_LIVE_UPDATE
 	{ "live-update", 0, NULL, 'U' },
+#endif
 	{ NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
@@ -2141,9 +2143,11 @@ int main(int argc, char *argv[])
 		case 'p':
 			priv_domid = strtol(optarg, NULL, 10);
 			break;
+#ifndef NO_LIVE_UPDATE
 		case 'U':
 			live_update = true;
 			break;
+#endif
 		}
 	}
 	if (optind != argc)
@@ -2206,9 +2210,11 @@ int main(int argc, char *argv[])
 	if (tracefile)
 		tracefile = talloc_strdup(NULL, tracefile);
 
+#ifndef NO_LIVE_UPDATE
 	/* Read state in case of live update. */
 	if (live_update)
 		lu_read_state();
+#endif
 
 	/* Get ready to listen to the tools. */
 	initialize_fds(&sock_pollfd_idx, &timeout);

Re: [PATCH] xenstored: fix build on libc without O_CLOEXEC
Posted by Ian Jackson 3 years, 2 months ago
Jan Beulich writes ("[PATCH] xenstored: fix build on libc without O_CLOEXEC"):
> The call to lu_read_state() would remain unresolved in this case. Frame
> the construct by a suitable #ifdef, and while at it also frame command
> line handling related pieces similarly.
> 
> Fixes: 9777fa6b6ea0 ("tools/xenstore: evaluate the live update flag when starting")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Personally my preference would have been to retain the command line
option parsing and have it bomb out with an error message here:

> +#ifndef NO_LIVE_UPDATE
>  	/* Read state in case of live update. */
>  	if (live_update)
>  		lu_read_state();
> +#endif

But you have written the patch and what you have done is reasonable.

Thanks,
Ian.