diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common.c | 6 | ||||
-rw-r--r-- | src/common.h | 2 | ||||
-rw-r--r-- | src/idevicerestore.c | 3 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/common.c b/src/common.c index bb534e2..c3c9d68 100644 --- a/src/common.c +++ b/src/common.c @@ -696,10 +696,10 @@ int _plist_dict_copy_item(plist_t target_dict, plist_t source_dict, const char * return 0; } -char* path_get_basename(char* path) +const char* path_get_basename(char* path) { #ifdef WIN32 - char *p = path + strlen(path); + const char *p = path + strlen(path); while (p > path) { if ((*p == '/') || (*p == '\\')) { return p+1; @@ -708,7 +708,7 @@ char* path_get_basename(char* path) } return p; #else - char *p = strrchr(path, '/'); + const char *p = strrchr(path, '/'); return p ? p + 1 : path; #endif } diff --git a/src/common.h b/src/common.h index f7b1dcd..974d505 100644 --- a/src/common.h +++ b/src/common.h @@ -197,7 +197,7 @@ int _plist_dict_copy_data(plist_t target_dict, plist_t source_dict, const char * int _plist_dict_copy_string(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); int _plist_dict_copy_item(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); -char* path_get_basename(char* path); +const char* path_get_basename(char* path); #ifdef __cplusplus } diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 9bc9f8b..064c503 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -987,8 +987,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) if (stat(client->cache_dir, &st) < 0) { mkdir_with_parents(client->cache_dir, 0755); } - char* ipsw_basename = path_get_basename(client->ipsw->path); - ipsw_basename = strdup(ipsw_basename); + char* ipsw_basename = strdup(path_get_basename(client->ipsw->path)); char* p = strrchr(ipsw_basename, '.'); if (p && isalpha(*(p+1))) { *p = '\0'; |