Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Fix isse where __mkdir return codes would be inconsistent on Win32 & …
Browse files Browse the repository at this point in the history
…Unix
  • Loading branch information
qmfrederik committed May 18, 2020
1 parent b236cd9 commit 595ea5b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/idevicebackup2.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,13 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil
static int __mkdir(const char* path, int mode)
{
#ifdef WIN32
return CreateDirectory(path, NULL);
// CreateDirectory returns a non-zero value on success,
// and zero on failure
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createdirectorya
return CreateDirectory(path, NULL) == 0;
#else
// mkdir returns zero on success, and an error code on failure
// https://linux.die.net/man/2/mkdir
return mkdir(path, mode);
#endif
}
Expand Down

0 comments on commit 595ea5b

Please sign in to comment.