[LTP] [PATCH] prot_hsymlinks: Fix failure on read-only machine

Alexey Kodanev alexey.kodanev@oracle.com
Wed Apr 5 19:25:20 CEST 2017


Hi,
On 10.03.2017 3:54, the_hoang0709@yahoo.com wrote:
> ...
>  	if (disable_protected_hlinks) {
>  		tst_resm(TINFO, "Disable protected hardlinks mode back");
> @@ -316,8 +317,13 @@ static void test_user_cmd(const char *user_cmd)
>  	char cmd[MAX_CMD_LEN];
>  	snprintf(cmd, MAX_CMD_LEN, "%s %s", user_cmd, users[TEST_USER].name);
>  	if (system(cmd) != 0) {
> -		tst_brkm(TBROK, cleanup, "Failed to run cmd: %s %s",
> +		if (eaccess("/etc/passwd", W_OK)) {
> +			tst_brkm(TCONF, cleanup,
> +			"/etc/passwd is not accessible");

It would be better to add this check to the top of setup(), right after
tst_kvercmp(), and exit without doing cleanup.

Thanks,
Alexey



More information about the ltp mailing list