1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-23 04:54:26 +00:00

Bugfix: Copy argv[0] given to dirname()

Per manpage, dirname can (and does on GNU/Linux!) modify its argument
This commit is contained in:
Luke Dashjr 2012-07-23 15:48:00 +00:00
parent 56907db2d6
commit a1cb0d06d5

View File

@ -4105,6 +4105,7 @@ int main (int argc, char *argv[])
bool pools_active = false; bool pools_active = false;
struct sigaction handler; struct sigaction handler;
struct thr_info *thr; struct thr_info *thr;
char *s;
unsigned int k; unsigned int k;
int i, j; int i, j;
@ -4135,7 +4136,9 @@ int main (int argc, char *argv[])
opt_kernel_path = alloca(PATH_MAX); opt_kernel_path = alloca(PATH_MAX);
strcpy(opt_kernel_path, CGMINER_PREFIX); strcpy(opt_kernel_path, CGMINER_PREFIX);
cgminer_path = alloca(PATH_MAX); cgminer_path = alloca(PATH_MAX);
strcpy(cgminer_path, dirname(argv[0])); s = strdup(argv[0]);
strcpy(cgminer_path, dirname(s));
free(s);
strcat(cgminer_path, "/"); strcat(cgminer_path, "/");
#ifdef WANT_CPUMINE #ifdef WANT_CPUMINE
// Hack to make cgminer silent when called recursively on WIN32 // Hack to make cgminer silent when called recursively on WIN32