diff --git a/cmds-filesystem.c b/cmds-filesystem.c index e84f12b7..ccf89c66 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -829,7 +829,7 @@ static int cmd_show(int argc, char **argv) /* default, search both kernel and udev */ int where = -1; int type = 0; - char mp[BTRFS_PATH_NAME_MAX + 1]; + char mp[PATH_MAX]; char path[PATH_MAX]; __u8 fsid[BTRFS_FSID_SIZE]; char uuid_buf[BTRFS_UUID_UNPARSED_SIZE]; diff --git a/cmds-inspect.c b/cmds-inspect.c index bdb7f637..053cf8ea 100644 --- a/cmds-inspect.c +++ b/cmds-inspect.c @@ -270,7 +270,7 @@ static int cmd_subvolid_resolve(int argc, char **argv) int ret; int fd = -1; u64 subvol_id; - char path[BTRFS_PATH_NAME_MAX + 1]; + char path[PATH_MAX]; DIR *dirstream = NULL; if (check_argc_exact(argc, 3)) @@ -293,7 +293,7 @@ static int cmd_subvolid_resolve(int argc, char **argv) goto out; } - path[BTRFS_PATH_NAME_MAX] = '\0'; + path[PATH_MAX] = '\0'; printf("%s\n", path); out: diff --git a/cmds-receive.c b/cmds-receive.c index 61d7ed89..6e02efdb 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -979,7 +979,7 @@ static int do_receive(struct btrfs_receive *r, const char *tomnt, goto out; } - root_subvol_path = malloc(BTRFS_PATH_NAME_MAX); + root_subvol_path = malloc(PATH_MAX); if (!root_subvol_path) { ret = -ENOMEM; fprintf(stderr, "ERROR: couldn't allocate buffer for the root " @@ -988,7 +988,7 @@ static int do_receive(struct btrfs_receive *r, const char *tomnt, } ret = btrfs_subvolid_resolve(r->mnt_fd, root_subvol_path, - BTRFS_PATH_NAME_MAX, subvol_id); + PATH_MAX, subvol_id); if (ret) { fprintf(stderr, "ERROR: couldn't resolve our subvol path\n"); goto out; diff --git a/cmds-scrub.c b/cmds-scrub.c index 9ef421d6..b7aa8091 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -390,7 +390,7 @@ static int scrub_open_file(const char *datafile, int m) static int scrub_open_file_r(const char *fn_base, const char *fn_local) { int ret; - char datafile[BTRFS_PATH_NAME_MAX + 1]; + char datafile[PATH_MAX]; ret = scrub_datafile(fn_base, fn_local, NULL, datafile, sizeof(datafile)); if (ret < 0) @@ -402,7 +402,7 @@ static int scrub_open_file_w(const char *fn_base, const char *fn_local, const char *tmp) { int ret; - char datafile[BTRFS_PATH_NAME_MAX + 1]; + char datafile[PATH_MAX]; ret = scrub_datafile(fn_base, fn_local, tmp, datafile, sizeof(datafile)); if (ret < 0) @@ -414,8 +414,8 @@ static int scrub_rename_file(const char *fn_base, const char *fn_local, const char *tmp) { int ret; - char datafile_old[BTRFS_PATH_NAME_MAX + 1]; - char datafile_new[BTRFS_PATH_NAME_MAX + 1]; + char datafile_old[PATH_MAX]; + char datafile_new[PATH_MAX]; ret = scrub_datafile(fn_base, fn_local, tmp, datafile_old, sizeof(datafile_old)); if (ret < 0) @@ -1128,7 +1128,7 @@ static int scrub_start(int argc, char **argv, int resume) struct scrub_file_record *last_scrub = NULL; char *datafile = strdup(SCRUB_DATA_FILE); char fsid[BTRFS_UUID_UNPARSED_SIZE]; - char sock_path[BTRFS_PATH_NAME_MAX + 1] = ""; + char sock_path[PATH_MAX] = ""; struct scrub_progress_cycle spc; pthread_mutex_t spc_write_mutex = PTHREAD_MUTEX_INITIALIZER; void *terr; diff --git a/send-utils.c b/send-utils.c index cbaf2e90..e342f71a 100644 --- a/send-utils.c +++ b/send-utils.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "ctree.h" #include "send-utils.h" @@ -481,9 +482,9 @@ struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s, if (type == subvol_search_by_path) { info->path = strdup(path); } else { - info->path = malloc(BTRFS_PATH_NAME_MAX); + info->path = malloc(PATH_MAX); ret = btrfs_subvolid_resolve(s->mnt_fd, info->path, - BTRFS_PATH_NAME_MAX, root_id); + PATH_MAX, root_id); } out: diff --git a/utils.c b/utils.c index e89707c7..087f3715 100644 --- a/utils.c +++ b/utils.c @@ -1060,7 +1060,7 @@ out: */ int open_path_or_dev_mnt(const char *path, DIR **dirstream) { - char mp[BTRFS_PATH_NAME_MAX + 1]; + char mp[PATH_MAX]; int fdmnt; if (is_block_device(path)) { @@ -2056,7 +2056,7 @@ int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args, struct btrfs_fs_devices *fs_devices_mnt = NULL; struct btrfs_ioctl_dev_info_args *di_args; struct btrfs_ioctl_dev_info_args tmp; - char mp[BTRFS_PATH_NAME_MAX + 1]; + char mp[PATH_MAX]; DIR *dirstream = NULL; memset(fi_args, 0, sizeof(*fi_args));