summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-volume.c20
-rw-r--r--cli/src/cli-rpc-ops.c12
-rw-r--r--cli/src/cli.c2
3 files changed, 18 insertions, 16 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 73579a5581b..4cff9e9e7c0 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1123,7 +1123,7 @@ gf_cli_create_auxiliary_mount (char *volname)
}
GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/");
- ret = mkdir (mountdir, 0777);
+ ret = sys_mkdir (mountdir, 0777);
if (ret && errno != EEXIST) {
gf_log ("cli", GF_LOG_ERROR, "Failed to create auxiliary mount "
"directory %s. Reason : %s", mountdir,
@@ -1253,9 +1253,10 @@ _limits_set_on_volume (char *volname, int type) {
/* TODO: fix hardcoding; Need to perform an RPC call to glusterd
* to fetch working directory
*/
- sprintf (quota_conf_file, "%s/vols/%s/quota.conf",
- GLUSTERD_DEFAULT_WORKDIR,
- volname);
+ snprintf (quota_conf_file, sizeof quota_conf_file,
+ "%s/vols/%s/quota.conf",
+ GLUSTERD_DEFAULT_WORKDIR,
+ volname);
fd = open (quota_conf_file, O_RDONLY);
if (fd == -1)
goto out;
@@ -1283,7 +1284,7 @@ _limits_set_on_volume (char *volname, int type) {
}
out:
if (fd != -1)
- close (fd);
+ sys_close (fd);
return limits_set;
}
@@ -1421,9 +1422,10 @@ cli_cmd_quota_handle_list_all (const char **words, dict_t *options)
//TODO: fix hardcoding; Need to perform an RPC call to glusterd
//to fetch working directory
- sprintf (quota_conf_file, "%s/vols/%s/quota.conf",
- GLUSTERD_DEFAULT_WORKDIR,
- volname);
+ snprintf (quota_conf_file, sizeof quota_conf_file,
+ "%s/vols/%s/quota.conf",
+ GLUSTERD_DEFAULT_WORKDIR,
+ volname);
fd = open (quota_conf_file, O_RDONLY);
if (fd == -1) {
//This may because no limits were yet set on the volume
@@ -1504,7 +1506,7 @@ out:
}
if (fd != -1) {
- close (fd);
+ sys_close (fd);
}
GF_FREE (gfid_str);
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 553a94a219a..562c176a2f9 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -5280,7 +5280,7 @@ write_contents_to_common_pem_file (dict_t *dict, int output_count)
"%s/geo-replication/common_secret.pem.pub",
workdir);
- unlink (common_pem_file);
+ sys_unlink (common_pem_file);
fd = open (common_pem_file, O_WRONLY | O_CREAT, 0600);
if (fd == -1) {
@@ -5302,7 +5302,7 @@ write_contents_to_common_pem_file (dict_t *dict, int output_count)
cli_out ("Unable to fetch output.");
}
if (output) {
- bytes_written = write (fd, output, strlen(output));
+ bytes_written = sys_write (fd, output, strlen(output));
if (bytes_written != strlen(output)) {
gf_log ("", GF_LOG_ERROR, "Failed to write "
"to %s", common_pem_file);
@@ -5310,7 +5310,7 @@ write_contents_to_common_pem_file (dict_t *dict, int output_count)
goto out;
}
/* Adding the new line character */
- bytes_written = write (fd, "\n", strlen("\n"));
+ bytes_written = sys_write (fd, "\n", strlen("\n"));
if (bytes_written != strlen("\n")) {
gf_log ("", GF_LOG_ERROR,
"Failed to add new line char");
@@ -5325,7 +5325,7 @@ write_contents_to_common_pem_file (dict_t *dict, int output_count)
ret = 0;
out:
if (fd >= 0)
- close (fd);
+ sys_close (fd);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
@@ -10488,7 +10488,7 @@ gf_cli_get_vol_opt_cbk (struct rpc_req *req, struct iovec *iov, int count,
cli_out ("%-40s%-40s", "Option", "Value");
cli_out ("%-40s%-40s", "------", "-----");
for (i=1; i<=count; i++) {
- sprintf (dict_key, "key%d", i);
+ snprintf (dict_key, sizeof dict_key, "key%d", i);
ret = dict_get_str (dict, dict_key, &key);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Failed to"
@@ -10496,7 +10496,7 @@ gf_cli_get_vol_opt_cbk (struct rpc_req *req, struct iovec *iov, int count,
"dictionary", dict_key);
goto out;
}
- sprintf (dict_key, "value%d", i);
+ snprintf (dict_key, sizeof dict_key, "value%d", i);
ret = dict_get_str (dict, dict_key, &value);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Failed to "
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 5707d3fbdd7..46736bbf76d 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -405,7 +405,7 @@ parse_cmdline (int argc, char *argv[], struct cli_state *state)
state->argv=&argv[1];
/* Do this first so that an option can override. */
- if (access(SECURE_ACCESS_FILE,F_OK) == 0) {
+ if (sys_access (SECURE_ACCESS_FILE, F_OK) == 0) {
state->ctx->secure_mgmt = 1;
}