Skip to content

Commit

Permalink
Add guard to avoid storage from being added twice
Browse files Browse the repository at this point in the history
Add guard in mtp_add_storage() to avoid the same storage from being
added twice.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Apr 1, 2021
1 parent e312f10 commit 792f8bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ uint32_t mtp_add_storage(mtp_ctx * ctx, char * path, char * description, uint32_

PRINT_DEBUG("mtp_add_storage : %s", path );

if (mtp_get_storage_id_by_name(ctx, description) != 0xFFFFFFFF)
return 0x00000000;

i = 0;
while(i < MAX_STORAGE_NB)
{
Expand Down

0 comments on commit 792f8bb

Please sign in to comment.