Project

General

Profile

Bug #23134 ยป ceph-rbd-rbdfuse-use-relpaths-too.patch

Rishabh Dave, 02/26/2018 10:57 AM

View differences:

src/rbd_fuse/rbd-fuse.cc
return r;
}
void get_appropriate_ceph_conf(struct fuse_args args)
{
int i;
char *c = NULL;
/* Since, getenv()'s return value can be overwritten by
* subsequent calls, use its copies. */
char *ceph_conf = NULL;
/* '- 1' since we also check that '-c' or '-config' is followed by
* a path. */
for (i = 0; i < args.argc - 1; ++i) {
if ((strcmp(args.argv[i], "-c") == 0 or strcmp(args.argv[i],
"--config") == 0) and args.argv[i + 1][0] != '-')
break;
}
/* If arguments do not have '-c' option passed... */
if (i == args.argc - 2) {
c = strdup(args.argv[i + 1]);
printf("c = %s\nargs.argv[i + 1] = %s\n", c, args.argv[i + 1]);
ceph_conf = realpath(c, ceph_conf);
args.argv[i + 1] = ceph_conf;
if (access(c, R_OK) != 0)
ceph_conf = NULL;
}
if (ceph_conf != NULL)
rbd_options.ceph_config = strdup(ceph_conf);
}
int main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
get_appropriate_ceph_conf(args);
if (fuse_opt_parse(&args, &rbd_options, rbdfs_opts, rbdfs_opt_proc) == -1) {
exit(1);
}
    (1-1/1)