forked from Mirrors/btrfs-progs
btrfs-progs: rename __strncpy__null to __strncpy_null
Signed-off-by: David Sterba <dsterba@suse.com>master
parent
c7f72072bd
commit
41f6ae4820
6
utils.c
6
utils.c
|
@ -1683,7 +1683,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __strncpy__null - strncpy with null termination
|
* __strncpy_null - strncpy with null termination
|
||||||
* @dest: the target array
|
* @dest: the target array
|
||||||
* @src: the source string
|
* @src: the source string
|
||||||
* @n: maximum bytes to copy (size of *dest)
|
* @n: maximum bytes to copy (size of *dest)
|
||||||
|
@ -1694,7 +1694,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
|
||||||
* byte ('\0'), to the buffer pointed to by dest, up to a maximum
|
* byte ('\0'), to the buffer pointed to by dest, up to a maximum
|
||||||
* of n bytes. Then ensure that dest is null-terminated.
|
* of n bytes. Then ensure that dest is null-terminated.
|
||||||
*/
|
*/
|
||||||
char *__strncpy__null(char *dest, const char *src, size_t n)
|
char *__strncpy_null(char *dest, const char *src, size_t n)
|
||||||
{
|
{
|
||||||
strncpy(dest, src, n);
|
strncpy(dest, src, n);
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
|
@ -2969,7 +2969,7 @@ int arg_copy_path(char *dest, const char *src, int destlen)
|
||||||
if (len >= PATH_MAX || len >= destlen)
|
if (len >= PATH_MAX || len >= destlen)
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
__strncpy__null(dest, src, destlen);
|
__strncpy_null(dest, src, destlen);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
4
utils.h
4
utils.h
|
@ -160,7 +160,7 @@ int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args,
|
||||||
int get_label(const char *btrfs_dev, char *label);
|
int get_label(const char *btrfs_dev, char *label);
|
||||||
int set_label(const char *btrfs_dev, const char *label);
|
int set_label(const char *btrfs_dev, const char *label);
|
||||||
|
|
||||||
char *__strncpy__null(char *dest, const char *src, size_t n);
|
char *__strncpy_null(char *dest, const char *src, size_t n);
|
||||||
int is_block_device(const char *file);
|
int is_block_device(const char *file);
|
||||||
int is_mount_point(const char *file);
|
int is_mount_point(const char *file);
|
||||||
int check_arg_type(const char *input);
|
int check_arg_type(const char *input);
|
||||||
|
@ -168,7 +168,7 @@ int open_path_or_dev_mnt(const char *path, DIR **dirstream, int verbose);
|
||||||
int btrfs_open_dir(const char *path, DIR **dirstream, int verbose);
|
int btrfs_open_dir(const char *path, DIR **dirstream, int verbose);
|
||||||
u64 btrfs_device_size(int fd, struct stat *st);
|
u64 btrfs_device_size(int fd, struct stat *st);
|
||||||
/* Helper to always get proper size of the destination string */
|
/* Helper to always get proper size of the destination string */
|
||||||
#define strncpy_null(dest, src) __strncpy__null(dest, src, sizeof(dest))
|
#define strncpy_null(dest, src) __strncpy_null(dest, src, sizeof(dest))
|
||||||
int test_dev_for_mkfs(const char *file, int force_overwrite);
|
int test_dev_for_mkfs(const char *file, int force_overwrite);
|
||||||
int get_label_mounted(const char *mount_path, char *labelp);
|
int get_label_mounted(const char *mount_path, char *labelp);
|
||||||
int get_label_unmounted(const char *dev, char *label);
|
int get_label_unmounted(const char *dev, char *label);
|
||||||
|
|
Loading…
Reference in New Issue