]> git.ipfire.org Git - thirdparty/lxc.git/commit
lxc/attach: Detect EACCES from execvp and convert to 126 exit status
authorThomas Parrott <thomas.parrott@canonical.com>
Thu, 13 Oct 2022 14:33:30 +0000 (15:33 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 16 Dec 2022 16:35:07 +0000 (11:35 -0500)
commit9165ff1edf3ee289f265a378ac6744487184e7fc
tree50bbd8d1671217c96d18c634129bc952656a17c1
parent011faff362e0e7c1c86121937f284ac8c64aba9f
lxc/attach: Detect EACCES from execvp and convert to 126 exit status

Before:

  sudo lxc-attach -n test /etc/passwd ; echo $?
  lxc-attach: test: ../src/lxc/attach.c: lxc_attach_run_command: 1841 Permission denied - Failed to exec "/etc/passwd"
  255

After:

  sudo lxc-attach -n test /etc/passwd ; echo $?
  lxc-attach: test: ../src/lxc/attach.c: lxc_attach_run_command: 1841 Permission denied - Failed to exec "/etc/passwd"
  126

Which better aligns with bash:

  /etc/passwd; echo $?
  bash: /etc/passwd: Permission denied
  126

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
src/lxc/attach.c