mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-11 18:48:08 +08:00
fix cppchecker
This commit is contained in:
parent
2ffcdc67f6
commit
4b8ee5a039
1 changed files with 6 additions and 10 deletions
|
@ -518,10 +518,9 @@ static void set_my_user_directory(void) {
|
|||
if (my_user_directory == NULL) {
|
||||
|
||||
uint16_t pathLen = FILENAME_MAX; // should be a good starting point
|
||||
bool error = false;
|
||||
char *cwd_buffer = (char *)calloc(pathLen, sizeof(uint8_t));
|
||||
|
||||
while (!error && (GetCurrentDir(cwd_buffer, pathLen) == NULL)) {
|
||||
while (GetCurrentDir(cwd_buffer, pathLen) == NULL) {
|
||||
if (errno == ERANGE) { // Need bigger buffer
|
||||
pathLen += 10; // if buffer was too small add 10 characters and try again
|
||||
char *tmp = realloc(cwd_buffer, pathLen);
|
||||
|
@ -537,16 +536,13 @@ static void set_my_user_directory(void) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
|
||||
for (int i = 0; i < strlen(cwd_buffer); i++) {
|
||||
if (cwd_buffer[i] == '\\') {
|
||||
cwd_buffer[i] = '/';
|
||||
}
|
||||
for (int i = 0; i < strlen(cwd_buffer); i++) {
|
||||
if (cwd_buffer[i] == '\\') {
|
||||
cwd_buffer[i] = '/';
|
||||
}
|
||||
|
||||
my_user_directory = cwd_buffer;
|
||||
}
|
||||
|
||||
my_user_directory = cwd_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue