btrfs-progs: path-utils: rename path_is_mount_point to avoid potential symbol name clash

There's a report that a static build fails when there's a static version
of libudev:

  /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/libudev.a(path-util.o): in function `path_is_mount_point':
  path-util.c:(.text+0xbc0): multiple definition of `path_is_mount_point'; common/path-utils.o:path-utils.c:(.text+0x290): first defined here

There's a helper path_is_mount_point in libudev too but not exported so
dynamic library is fine, unlike static build. The static build of
libudev is not common but we can support that with a simple rename.

Issue: #611
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-04-03 19:14:13 +02:00
parent 91a83034c5
commit 6ea85b680b
3 changed files with 9 additions and 5 deletions

View File

@ -76,7 +76,7 @@ int check_arg_type(const char *input)
if (path_is_block_device(path) == 1)
return BTRFS_ARG_BLKDEV;
if (path_is_mount_point(path) == 1)
if (path_is_a_mount_point(path) == 1)
return BTRFS_ARG_MNTPOINT;
if (path_is_reg_file(path))

View File

@ -50,10 +50,14 @@ int path_is_block_device(const char *path)
}
/*
* check if given path is a mount point
* return 1 if yes. 0 if no. -1 for error
* Check if given path is a mount point. (Note: a similar function also exists
* in libudev so it's been renamed to avoid clash.)
*
* Return: 1 if yes,
* 0 if no,
* -1 for error
*/
int path_is_mount_point(const char *path)
int path_is_a_mount_point(const char *path)
{
FILE *f;
struct mntent *mnt;

View File

@ -32,7 +32,7 @@ char *__strncpy_null(char *dest, const char *src, size_t n);
#define strncpy_null(dest, src) __strncpy_null(dest, src, sizeof(dest))
int path_is_block_device(const char *file);
int path_is_mount_point(const char *file);
int path_is_a_mount_point(const char *file);
int path_exists(const char *file);
int path_is_reg_file(const char *path);
int path_is_dir(const char *path);