mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-24 15:38:11 +00:00
Fix some code in restore.c to make cppcheck happy
This commit is contained in:
parent
c254138c21
commit
733a7385b4
@ -45,18 +45,17 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (rd->pid)
|
||||
{
|
||||
#if defined (_POSIX)
|
||||
|
||||
char *pidbin = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_LARGE); VERIFY_PTR (pidbin);
|
||||
|
||||
int pidbin_len = -1;
|
||||
|
||||
#if defined (_POSIX)
|
||||
snprintf (pidbin, HCBUFSIZ_LARGE - 1, "/proc/%u/cmdline", rd->pid);
|
||||
|
||||
FILE *fd = fopen (pidbin, "rb");
|
||||
|
||||
if (fd)
|
||||
{
|
||||
pidbin_len = fread (pidbin, 1, HCBUFSIZ_LARGE, fd);
|
||||
size_t pidbin_len = fread (pidbin, 1, HCBUFSIZ_LARGE, fd);
|
||||
|
||||
pidbin[pidbin_len] = 0;
|
||||
|
||||
@ -78,15 +77,17 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
hcfree (pidbin);
|
||||
|
||||
#elif defined (_WIN)
|
||||
|
||||
HANDLE hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, rd->pid);
|
||||
|
||||
char *pidbin = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_LARGE); VERIFY_PTR (pidbin);
|
||||
char *pidbin2 = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_LARGE); VERIFY_PTR (pidbin2);
|
||||
|
||||
int pidbin2_len = -1;
|
||||
|
||||
pidbin_len = GetModuleFileName (NULL, pidbin, HCBUFSIZ_LARGE);
|
||||
pidbin2_len = GetModuleFileNameEx (hProcess, NULL, pidbin2, HCBUFSIZ_LARGE);
|
||||
int pidbin_len = GetModuleFileName (NULL, pidbin, HCBUFSIZ_LARGE);
|
||||
int pidbin2_len = GetModuleFileNameEx (hProcess, NULL, pidbin2, HCBUFSIZ_LARGE);
|
||||
|
||||
pidbin[pidbin_len] = 0;
|
||||
pidbin2[pidbin2_len] = 0;
|
||||
@ -102,10 +103,9 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
|
||||
hcfree (pidbin2);
|
||||
hcfree (pidbin);
|
||||
|
||||
#endif
|
||||
|
||||
hcfree (pidbin);
|
||||
}
|
||||
|
||||
if (rd->version < RESTORE_VERSION_MIN)
|
||||
|
Loading…
Reference in New Issue
Block a user