Commit 4a7c7daa by Serge Hallyn Committed by Stéphane Graber

Fix passing non-const char* in for const char*

parent c278cef2
...@@ -201,7 +201,7 @@ extern int lxc_container_put(struct lxc_container *c); ...@@ -201,7 +201,7 @@ extern int lxc_container_put(struct lxc_container *c);
* Get a list of valid wait states. * Get a list of valid wait states.
* If states is NULL, simply return the number of states * If states is NULL, simply return the number of states
*/ */
extern int lxc_get_wait_states(char **states); extern int lxc_get_wait_states(const char **states);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -87,5 +87,5 @@ int main(int argc, char *argv[]) ...@@ -87,5 +87,5 @@ int main(int argc, char *argv[])
my_args.progname, my_args.quiet)) my_args.progname, my_args.quiet))
return -1; return -1;
return lxc_wait(my_args.name, my_args.states, my_args.timeout); return lxc_wait(strdup(my_args.name), my_args.states, my_args.timeout);
} }
...@@ -906,7 +906,7 @@ err: ...@@ -906,7 +906,7 @@ err:
return NULL; return NULL;
} }
int lxc_get_wait_states(char **states) int lxc_get_wait_states(const char **states)
{ {
int i; int i;
......
...@@ -63,7 +63,7 @@ struct lxc_container { ...@@ -63,7 +63,7 @@ struct lxc_container {
struct lxc_container *lxc_container_new(char *name); struct lxc_container *lxc_container_new(char *name);
int lxc_container_get(struct lxc_container *c); int lxc_container_get(struct lxc_container *c);
int lxc_container_put(struct lxc_container *c); int lxc_container_put(struct lxc_container *c);
int lxc_get_wait_states(char **states); int lxc_get_wait_states(const char **states);
#if 0 #if 0
char ** lxc_get_valid_keys(); char ** lxc_get_valid_keys();
......
...@@ -210,7 +210,7 @@ int main(int argc, char *argv[]) ...@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "%d: lxc_get_wait_states gave %d not %d\n", __LINE__, numstates, MAX_STATE); fprintf(stderr, "%d: lxc_get_wait_states gave %d not %d\n", __LINE__, numstates, MAX_STATE);
goto out; goto out;
} }
char **sstr = malloc(numstates * sizeof(char *)); const char **sstr = malloc(numstates * sizeof(const char *));
numstates = lxc_get_wait_states(sstr); numstates = lxc_get_wait_states(sstr);
int i; int i;
for (i=0; i<numstates; i++) { for (i=0; i<numstates; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment