diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-03-03 16:13:42 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-09 09:17:21 +0100 |
commit | 66ea109860b69ff3c7fd56230b1b86306956e452 (patch) | |
tree | f2d65057d2627a807d9cbc6455c84c2b60331f7c /shell | |
parent | 2f2975c7dee495b382f23aca8979d7f04ce2ffb2 (diff) |
Handle symlinks
LIBREOFFICE-PQ967WYM
Change-Id: I5e4df92401e009fe6b7238565d1223cfb77d10ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130930
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit c1ac79906bde5c902be5cb0ae6b530da96e52169)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130862
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/unix/exec/shellexec.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index d9da11334a64..ddfb2e682e47 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -123,12 +123,12 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar 0); } struct stat st; - auto const e2 = stat(pathname8.getStr(), &st); + auto const e2 = lstat(pathname8.getStr(), &st); if (e2 != 0) { auto const e3 = errno; - SAL_INFO("shell", "stat(" << pathname8 << ") failed with errno " << e3); + SAL_INFO("shell", "lstat(" << pathname8 << ") failed with errno " << e3); } - if (e2 == 0 && S_ISDIR(st.st_mode)) { + if (e2 == 0 && (S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))) { dir = true; } else if (e2 != 0 || !S_ISREG(st.st_mode) || (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0) |