]> git.proxmox.com Git - mirror_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)
committerThomas Parrott <thomas.parrott@canonical.com>
Thu, 13 Oct 2022 14:33:30 +0000 (15:33 +0100)
commitf7cadaa346a0233c00bbd60412c5f6148288d217
treefa2b21b38c88328a5938d925fd8e2b16766fbe20
parent1ec37707ea8c1302fc79a36d8af9a6c6f6fbd293
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