diff options
author | Niklas Hambüchen <mail@nh2.me> | 2017-05-13 02:45:49 +0200 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2018-05-03 11:47:03 +0000 |
commit | cfa4ff1417aba42f0dff3fe9d8e17acdaae4ffb2 (patch) | |
tree | 6c159c40064a2e1b04264d6501e5a66c31b59c43 /xlators | |
parent | 86a0a7e562f4f1c2f5e68c10a917aeaf1d984365 (diff) |
Don't use hardcoded /sbin, /usr/bin etc. paths. Fixes #1450546
Instead, rely on programs to be in PATH, as gluster already
does in many places across its code base.
Change-Id: Id21152fe42f5b67205d8f1571b0656c4d5f74246
BUG: 1450546
Signed-off-by: Niklas Hambuechen <mail@nh2.me>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 14 |
3 files changed, 6 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 1fbdbd8c2c1..6231fe3a7f4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -30,7 +30,7 @@ #ifndef _PATH_SETFATTR # ifdef GF_LINUX_HOST_OS -# define _PATH_SETFATTR "/usr/bin/setfattr" +# define _PATH_SETFATTR "setfattr" # endif # ifdef __NetBSD__ # define _PATH_SETFATTR "/usr/pkg/bin/setfattr" @@ -341,7 +341,7 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, if (type == GF_QUOTA_OPTION_TYPE_ENABLE || type == GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS) - runner_add_args (&runner, "/usr/bin/find", ".", NULL); + runner_add_args (&runner, "find", ".", NULL); else if (type == GF_QUOTA_OPTION_TYPE_DISABLE) { @@ -357,7 +357,7 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, VIRTUAL_QUOTA_XATTR_CLEANUP_KEY, "1", "{}", "\\", ";", NULL); #else - runner_add_args (&runner, "/usr/bin/find", ".", + runner_add_args (&runner, "find", ".", "-exec", _PATH_SETFATTR, "-n", VIRTUAL_QUOTA_XATTR_CLEANUP_KEY, "-v", "1", "{}", "\\", ";", NULL); diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index a9f4d829b77..7e58ae238e0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -120,7 +120,7 @@ glusterd_build_snap_device_path (char *device, char *snapname, } runinit (&runner); - runner_add_args (&runner, "/sbin/lvs", "--noheadings", "-o", "vg_name", + runner_add_args (&runner, "lvs", "--noheadings", "-o", "vg_name", device, NULL); runner_redir (&runner, STDOUT_FILENO, RUN_PIPE); snprintf (msg, sizeof (msg), "Get volume group for device %s", device); @@ -1911,7 +1911,7 @@ glusterd_is_thinp_brick (char *device, uint32_t *op_errno) runinit (&runner); - runner_add_args (&runner, "/sbin/lvs", "--noheadings", "-o", "pool_lv", + runner_add_args (&runner, "lvs", "--noheadings", "-o", "pool_lv", device, NULL); runner_redir (&runner, STDOUT_FILENO, RUN_PIPE); runner_log (&runner, this->name, GF_LOG_DEBUG, msg); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index f7b6ffc21af..42a4411d92e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -6662,7 +6662,6 @@ static struct fs_info { char *fs_tool_pattern; char *fs_tool_pkg; } glusterd_fs[] = { - /* some linux have these in /usr/sbin/and others in /sbin/? */ { "xfs", "xfs_info", NULL, "isize=", "xfsprogs" }, { "ext3", "tune2fs", "-l", "Inode size:", "e2fsprogs" }, { "ext4", "tune2fs", "-l", "Inode size:", "e2fsprogs" }, @@ -6683,7 +6682,6 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count) char *trail = NULL; runner_t runner = {0, }; struct fs_info *fs = NULL; - char fs_tool_name[256] = {0, }; static dict_t *cached_fs = NULL; memset (key, 0, sizeof (key)); @@ -6720,17 +6718,7 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count) cur_word = "N/A"; goto cached; } - - snprintf (fs_tool_name, sizeof (fs_tool_name), - "/usr/sbin/%s", fs->fs_tool_name); - if (sys_access (fs_tool_name, R_OK|X_OK) == 0) - runner_add_arg (&runner, fs_tool_name); - else { - snprintf (fs_tool_name, sizeof (fs_tool_name), - "/sbin/%s", fs->fs_tool_name); - if (sys_access (fs_tool_name, R_OK|X_OK) == 0) - runner_add_arg (&runner, fs_tool_name); - } + runner_add_arg (&runner, fs->fs_tool_name); break; } } |