Browse Source

Merge commit 'df91df3' into stratum

Conflicts:
	miner.c
Luke Dashjr 13 years ago
parent
commit
73fb7e22fb
1 changed files with 8 additions and 8 deletions
  1. 8 8
      miner.c

+ 8 - 8
miner.c

@@ -748,6 +748,7 @@ static char *set_pass(const char *arg)
 static char *set_userpass(const char *arg)
 {
 	struct pool *pool;
+	char *updup;
 
 	if (total_users != total_passes)
 		return "User + pass options must be balanced before userpass";
@@ -757,7 +758,14 @@ static char *set_userpass(const char *arg)
 		add_pool();
 
 	pool = pools[total_users - 1];
+	updup = strdup(arg);
 	opt_set_charp(arg, &pool->rpc_userpass);
+	pool->rpc_user = strtok(updup, ":");
+	if (!pool->rpc_user)
+		return "Failed to find : delimited user info";
+	pool->rpc_pass = strtok(NULL, ":");
+	if (!pool->rpc_pass)
+		return "Failed to find : delimited pass info";
 
 	return NULL;
 }
@@ -7136,14 +7144,6 @@ int main(int argc, char *argv[])
 			if (!pool->rpc_userpass)
 				quit(1, "Failed to malloc userpass");
 			sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass);
-		} else {
-			pool->rpc_user = malloc(strlen(pool->rpc_userpass) + 1);
-			if (!pool->rpc_user)
-				quit(1, "Failed to malloc user");
-			strcpy(pool->rpc_user, pool->rpc_userpass);
-			pool->rpc_user = strtok(pool->rpc_user, ":");
-			if (!pool->rpc_user)
-				quit(1, "Failed to find colon delimiter in userpass");
 		}
 	}
 	/* Set the currentpool to pool 0 */