Advertisement
Guest User

CGMiner Glob Patch

a guest
Oct 13th, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. --- main.org.c 2011-10-13 22:27:20.000000000 +0700
  2. +++ main.c 2011-10-14 00:17:18.000000000 +0700
  3. @@ -33,6 +33,7 @@
  4. #include <curl/curl.h>
  5. #include <libgen.h>
  6. #include <sha2.h>
  7. +#include <glob.h>
  8.  
  9. #include "compat.h"
  10. #include "miner.h"
  11. @@ -1701,14 +1702,23 @@
  12. {
  13. json_error_t err;
  14. json_t *config;
  15. -
  16. - config = json_load_file(arg, 0, &err);
  17. - if (!json_is_object(config))
  18. - return "JSON decode of file failed";
  19. -
  20. - /* Parse the config now, so we can override it. That can keep pointers
  21. - * so don't free config object. */
  22. - return parse_config(config);
  23. +
  24. + glob_t gfn;
  25. + glob(arg, GLOB_NOMAGIC|GLOB_TILDE, NULL, &gfn);
  26. + int n;
  27. + for(n = 0; n < gfn.gl_pathc; n++) {
  28. + config = json_load_file(gfn.gl_pathv[n], 0, &err);
  29. + if (!json_is_object(config))
  30. + return "JSON decode of file failed";
  31. +
  32. + /* Parse the config now, so we can override it. That can keep pointers
  33. + * so don't free config object. */
  34. + char *rtn = parse_config(config);
  35. + if(rtn != NULL)
  36. + return rtn;
  37. + }
  38. + globfree(&gfn);
  39. + return NULL;
  40. }
  41.  
  42. #ifdef HAVE_OPENCL
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement