diff --git a/common/path-utils.c b/common/path-utils.c index 929e5c8f..494fe828 100644 --- a/common/path-utils.c +++ b/common/path-utils.c @@ -491,8 +491,9 @@ int test_issubvolname(const char *name) * Unified GNU semantics basename helper, never changing the argument. Always * use this instead of basename(). */ -const char *path_basename(const char *path) +char *path_basename(char *path) { +#if 0 const char *tmp = strrchr(path, '/'); /* Special case when the whole path is just "/". */ @@ -500,6 +501,9 @@ const char *path_basename(const char *path) return path; return tmp ? tmp + 1 : path; +#else + return basename(path); +#endif } /* diff --git a/common/path-utils.h b/common/path-utils.h index 697fa6b4..da7e81e6 100644 --- a/common/path-utils.h +++ b/common/path-utils.h @@ -39,7 +39,7 @@ int path_is_dir(const char *path); int is_same_loop_file(const char *a, const char *b); int path_is_reg_or_block_device(const char *filename); int path_is_in_dir(const char *parent, const char *path); -const char *path_basename(const char *path); +char *path_basename(char *path); char *path_dirname(char *path); int test_issubvolname(const char *name);