[CRIU] [PATCH 1/2] lib/c: add const qualifier to criu_set_service_binary
Ronny Chevalier
ronny.chevalier at hp.com
Mon Jun 18 11:55:35 MSK 2018
service_binary is either set to a const char * (CR_DEFAULT_SERVICE_BIN)
or to a user provided char *, but there is no reason to give a char *.
Users of such function will most likely provide a const char *,
that will generate a warning.
Thus, we add the const qualifier to better represent the usage of
service_binary, and avoid such warnings.
Signed-off-by: Ronny Chevalier <ronny.chevalier at hp.com>
---
lib/c/criu.c | 6 +++---
lib/c/criu.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/c/criu.c b/lib/c/criu.c
index 832a54d1..ff9c9b87 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -27,7 +27,7 @@ struct criu_opts {
union {
char *service_address;
int service_fd;
- char *service_binary;
+ const char *service_binary;
};
int swrk_pid;
};
@@ -68,7 +68,7 @@ void criu_set_service_fd(int fd)
criu_local_set_service_fd(global_opts, fd);
}
-void criu_local_set_service_binary(criu_opts *opts, char *path)
+void criu_local_set_service_binary(criu_opts *opts, const char *path)
{
if (path)
opts->service_binary = path;
@@ -76,7 +76,7 @@ void criu_local_set_service_binary(criu_opts *opts, char *path)
opts->service_binary = CR_DEFAULT_SERVICE_BIN;
}
-void criu_set_service_binary(char *path)
+void criu_set_service_binary(const char *path)
{
criu_local_set_service_binary(global_opts, path);
}
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 5d0b5b6c..c531016e 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -43,7 +43,7 @@ enum criu_cg_mode {
void criu_set_service_address(char *path);
void criu_set_service_fd(int fd);
-void criu_set_service_binary(char *path);
+void criu_set_service_binary(const char *path);
/*
* You can choose if you want libcriu to connect to service socket
--
2.17.1
More information about the CRIU
mailing list