Correct error message when command doesn't exist in intercept mode.
Previously, we would always use EACCES, even when ENOENT was appropriate. This also affected log_subcmds.
This commit is contained in:
@@ -407,7 +407,7 @@ intercept_check_policy(const char *command, int argc, char **argv, int envc,
|
|||||||
*/
|
*/
|
||||||
if (stat(command, &sb) == -1) {
|
if (stat(command, &sb) == -1) {
|
||||||
closure->errstr = NULL;
|
closure->errstr = NULL;
|
||||||
closure->state = POLICY_REJECT;
|
closure->state = POLICY_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1920,9 +1920,12 @@ ptrace_intercept_execve(pid_t pid, struct intercept_closure *closure)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case POLICY_REJECT:
|
||||||
/* If rejected, fake the syscall and set return to EACCES */
|
/* If rejected, fake the syscall and set return to EACCES */
|
||||||
ptrace_fail_syscall(pid, ®s, EACCES);
|
errno = EACCES;
|
||||||
|
FALLTHROUGH;
|
||||||
|
default:
|
||||||
|
ptrace_fail_syscall(pid, ®s, errno);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user