1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

Use const pointer for return value of dm_basename

Fix return pointer to const as it is created from passed input const pointer.
This commit is contained in:
Zdenek Kabelac 2010-10-25 13:13:53 +00:00
parent 1e34e243a9
commit a636bccaba
3 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.56 - Version 1.02.56 -
===================================== =====================================
Fix API for dm_basename() and return const pointer for const input pointer.
Add --setuuid to dmsetup rename. Add --setuuid to dmsetup rename.
Add dm_task_set_newuuid to set uuid of mapped device post-creation. Add dm_task_set_newuuid to set uuid of mapped device post-creation.

View File

@ -955,7 +955,7 @@ int dm_snprintf(char *buf, size_t bufsize, const char *format, ...)
/* /*
* Returns pointer to the last component of the path. * Returns pointer to the last component of the path.
*/ */
char *dm_basename(const char *path); const char *dm_basename(const char *path);
/************************** /**************************
* file/stream manipulation * file/stream manipulation

View File

@ -123,11 +123,11 @@ int dm_snprintf(char *buf, size_t bufsize, const char *format, ...)
return n; return n;
} }
char *dm_basename(const char *path) const char *dm_basename(const char *path)
{ {
char *p = strrchr(path, '/'); const char *p = strrchr(path, '/');
return p ? p + 1 : (char *) path; return p ? p + 1 : path;
} }
int dm_asprintf(char **result, const char *format, ...) int dm_asprintf(char **result, const char *format, ...)