mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	test_crypto.c: Fix getcwd(…) build error.
`getcwd(…)` is decorated with the `warn_unused_result` attribute and therefore needs its return value checked. Change-Id: Idcccb20a0abf293202c28633d0e9ee0f6a9dbe93
This commit is contained in:
		| @@ -110,10 +110,16 @@ AST_TEST_DEFINE(crypto_rsa_encrypt) | ||||
|  | ||||
| 	if (!ast_check_command_in_path(command)) { | ||||
| 		ast_test_status_update(test, "couldn't find %s\n", command); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	if (getcwd(wd, sizeof(wd)) == NULL) { | ||||
| 		ast_test_status_update(test, "Could not determine current working directory\n"); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	getcwd(wd, sizeof(wd)); | ||||
| 	snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys"); | ||||
| 	push_key_dir((const char *)key_dir); | ||||
| 	snprintf(priv, sizeof(priv), "%s/%s.key", key_dir, keypair1); | ||||
| @@ -200,10 +206,16 @@ AST_TEST_DEFINE(crypto_rsa_decrypt) | ||||
|  | ||||
| 	if (!ast_check_command_in_path(command)) { | ||||
| 		ast_test_status_update(test, "couldn't find %s\n", command); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	if (getcwd(wd, sizeof(wd)) == NULL) { | ||||
| 		ast_test_status_update(test, "Could not determine current working directory\n"); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	getcwd(wd, sizeof(wd)); | ||||
| 	snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys"); | ||||
| 	push_key_dir((const char *)key_dir); | ||||
| 	snprintf(pub, sizeof(pub), "%s/%s.pub", key_dir, keypair1); | ||||
| @@ -297,10 +309,16 @@ AST_TEST_DEFINE(crypto_sign) | ||||
|  | ||||
| 	if (!ast_check_command_in_path(command)) { | ||||
| 		ast_test_status_update(test, "couldn't find %s\n", command); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	if (getcwd(wd, sizeof(wd)) == NULL) { | ||||
| 		ast_test_status_update(test, "Could not determine current working directory\n"); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	getcwd(wd, sizeof(wd)); | ||||
| 	snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys"); | ||||
| 	push_key_dir((const char *)key_dir); | ||||
| 	snprintf(pub, sizeof(pub), "%s/%s.pub", key_dir, keypair1); | ||||
| @@ -410,10 +428,16 @@ AST_TEST_DEFINE(crypto_verify) | ||||
|  | ||||
| 	if (!ast_check_command_in_path(command)) { | ||||
| 		ast_test_status_update(test, "couldn't find %s\n", command); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	if (getcwd(wd, sizeof(wd)) == NULL) { | ||||
| 		ast_test_status_update(test, "Could not determine current working directory\n"); | ||||
| 		ast_test_capture_free(&cap); | ||||
| 		return res; | ||||
| 	} | ||||
|  | ||||
| 	getcwd(wd, sizeof(wd)); | ||||
| 	snprintf(key_dir, sizeof(key_dir), "%s/%s", wd, "tests/keys"); | ||||
| 	push_key_dir((const char *)key_dir); | ||||
| 	snprintf(priv, sizeof(priv), "%s/%s.key", key_dir, keypair1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user